Start with the project you created in Low-Level DigitalPaint: Painting Using a Shape.
Add the following item to the popup menu "Painting Test " that you added to the main menu:
&Painting Test
&Region
with ID = IDM_PAINTTEST_REGION
Add the following function before the OnOpen function definition:
static L_VOID OnRegion ( HWND hWnd, pPAINTHANDLE pPaint ){HDC hDC ;PAINTREGION region ;RECT rcRegion ;HRGN hRgn ;region.nSize = sizeof ( PAINTREGION ) ;region.dwMask = PRF_ROUNDRECTELLIPSEWIDTH |PRF_ROUNDRECTELLIPSEHEIGHT ;region.nRoundRectEllipseWidth = 40 ;region.nRoundRectEllipseHeight = 40 ;// Set the new region propertiesL_PntSetProperty ( pPaint, PAINT_GROUP_REGION, ®ion ) ;// Get the device contexthDC = GetDC ( hWnd ) ;// Set the coordinates with respect to the DC dimensionsSetRect ( &rcRegion, 10, 10, 200, 200 ) ;// Use the current region properties and the current painting// transformations to create a rouned rectangle regionL_PntRegionRoundRect ( pPaint, hDC, &rcRegion, &hRgn ) ;// View the resulted regionFrameRgn ( hDC, hRgn, (HBRUSH)GetStockObject ( BLACK_BRUSH ), 1, 1 ) ;// Delete the regionDeleteObject ( hRgn ) ;// Release the device contextReleaseDC ( hWnd, hDC ) ;}
Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_SHAPE:" statement:
case IDM_PAINTTEST_REGION:OnRegion ( hWnd, pPaint ) ;return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.