Start with the project you created in Low-Level DigitalPaint: Creating a Region.
IDM_PAINTTEST_FILLstatic L_VOID OnFill ( HWND hWnd, pPAINTHANDLE pPaint ){HDC hDC ;PAINTSHAPE shape ;PAINTFILL fill ;RECT rcShape ;RECT rcDCExtents ;// Get device context to draw onhDC = GetDC ( hWnd ) ;// Set the required shape propertiesshape.nSize = sizeof ( PAINTSHAPE ) ;shape.dwMask = PSF_BORDERWIDTH |PSF_BORDERCOLOR |PSF_BACKGROUNDCOLOR ;shape.nBorderWidth = 10 ;shape.crBorderColor = RGB ( 255, 0, 0 ) ;shape.crBackgroundColor = RGB ( 255, 0, 0 ) ;// Set the new shape propertiesL_PntSetProperty ( pPaint, PAINT_GROUP_SHAPE, &shape ) ;// Set the coordinates with respect to the DC dimensionsSetRect ( &rcShape, 10, 10, 60, 60 ) ;// Use the current shape properties to draw an ellipse to the DC (hDC)L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;SetRect ( &rcShape, 100, 10, 150, 60 ) ;L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;SetRect ( &rcShape, 60, 60, 95, 95 ) ;L_PntDrawShapeRectangle ( pPaint, hDC, &rcShape ) ;SetRect ( &rcShape, 10, 100, 60, 150 ) ;L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;SetRect ( &rcShape, 100, 100, 150, 150 ) ;L_PntDrawShapeEllipse ( pPaint, hDC, &rcShape ) ;// Get the destination DC dimensionsGetClientRect ( hWnd, &rcDCExtents ) ;// Set the toolkit user DC extentsL_PntSetDCExtents ( pPaint, &rcDCExtents ) ;// Set the required fill propertiesfill.nSize = sizeof ( PAINTFILL ) ;fill.dwMask = PFF_STYLE ;fill.nStyle = PAINT_FILL_STYLE_GRADIENT ;// Set the new fill propertiesL_PntSetProperty ( pPaint, PAINT_GROUP_FILL, &fill ) ;// Fill the target areaL_PntFillColorReplace ( pPaint, hDC, RGB ( 255, 0, 0 ) ) ;// Release the device contextReleaseDC ( hWnd, hDC ) ;}
Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_REGION:" statement:
case IDM_PAINTTEST_FILL:OnFill ( hWnd, pPaint ) ;return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.