Start with the project you created in Low-Level DigitalPaint: Setting General DigitalPaint Information.
Add the following popup menu to the main menu you created in Low-Level DigitalPaint: Initializing and Freeing a Paint Handle.
IDM_PAINTTEST_BRUSH
Add the following function before the OnOpen function definition:
static L_VOID OnBrush ( HWND hWnd, pPAINTHANDLE pPaint )
{
HDC hDC ;
PAINTBRUSH brush ;
// Reset all of the brush fields
memset ( &brush, 0, sizeof ( brush ) ) ;
// Get device context to draw on
hDC = GetDC ( hWnd ) ;
// Set the required paintbrush properties
brush.nSize = sizeof ( PAINTBRUSH ) ;
brush.dwMask = PBF_DIAMETER |
PBF_TOUCH |
PBF_SPACING ;
brush.nDiameter = 20 ;
brush.Touch.crColor = RGB ( 255, 0, 0 ) ;
brush.nSpacing = 25 ;
// Set the new paintbruch properties
L_PntSetProperty ( pPaint, PAINT_GROUP_BRUSH, &brush ) ;
// Use the current paintbruch properties to draw a paintbrush stroke to DC (hDC)
L_PntBrushMoveTo ( pPaint, hDC, 10, 10 ) ;
L_PntBrushLineTo ( pPaint, hDC, 500, 500 ) ;
// Release the device context
ReleaseDC ( hWnd, hDC ) ;
}
Add the following code after the statement "return 0L;" of the "case IDM_FILE_EXIT
:" statement:
case IDM_PAINTTEST_BRUSH:
OnBrush ( hWnd, pPaint ) ;
return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.