Start with the project you created in Low-Level DigitalPaint: Painting with a Brush.
static L_VOID OnShape ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTSHAPE shape;
// Set the required shape properties
shape.nSize = sizeof ( PAINTSHAPE ) ;
shape.dwMask = PSF_BORDERWIDTH |
PSF_BORDERSTYLE |
PSF_BORDERCOLOR |
PSF_BORDERENDCAP ;
shape.nBorderWidth = 10 ;
shape.nBorderStyle = PAINT_SHAPE_BORDER_STYLE_DASHDOT ;
shape.crBorderColor = RGB ( 255, 0, 0 ) ;
shape.nBorderEndCap = PAINT_SHAPE_BORDER_ENDCAP_ROUND ;
// Set the new shape properties
L_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;
// Get device context to draw on
hDC = GetDC ( hWnd ) ;
// Use the current shape properties to draw a line to the currently selected bitmap
L_PntDrawShapeLine ( pPaint, hDC, 10, 10, 400, 400 ) ;
// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}
Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_BRUSH:" statement:
case IDM_PAINTTEST_SHAPE:
OnShape ( hWnd, pPaint ) ;
return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.