Start with the project you created in Low-Level DigitalPaint: Filling an Area.
IDM_PAINTTEST_TEXTstatic L_VOID OnText ( HWND hWnd, pPAINTHANDLE pPaint ){HDC hDC ;PAINTTEXT text ;RECT rcText ;LOGFONTW lf ;HFONT hFont ;// Get device context to draw onhDC = GetDC ( hWnd ) ;// Set the required text font propertieslf.lfHeight = 48 ;lf.lfWidth = 0 ;lf.lfEscapement = 0 ;lf.lfOrientation = 0 ;lf.lfWeight = FW_NORMAL ;lf.lfItalic = FALSE ;lf.lfUnderline = FALSE ;lf.lfStrikeOut = FALSE ;lf.lfCharSet = ANSI_CHARSET ;lf.lfOutPrecision = OUT_DEFAULT_PRECIS ;lf.lfClipPrecision = CLIP_DEFAULT_PRECIS ;lf.lfQuality = DEFAULT_QUALITY ;lf.lfPitchAndFamily = FF_DONTCARE ;lstrcpy ( lf.lfFaceName, TEXT("Times New Roman")) ;// Create the desired text fonthFont = CreateFontIndirect ( &lf ) ;// Set the desired text propertiestext.nSize = sizeof ( PAINTTEXT ) ;text.dwMask = PTF_TEXT | PTF_FONT | PTF_TRANSFORMINFO ;text.pszText = TEXT("LEAD") ;text.hFont = hFont ;text.TransformInfo.Scale.cx = 100 ;text.TransformInfo.Scale.cy = 100 ;text.TransformInfo.nRotate = 45 ;// Set the new text propertiesL_PntSetProperty ( pPaint, PAINT_GROUP_TEXT, &text ) ;// Set the target text drawing box coordinates with respect to the DC dimensionsSetRect ( &rcText, 10, 10, 200, 200 ) ;// Use the current text properties and the current transformations properties// to draw the text to the DCL_PntApplyText ( pPaint, hDC, &rcText ) ;// Delete the font objectDeleteObject ( hFont ) ;// Release the device contextReleaseDC ( hWnd, hDC ) ;}
Add the following line after the "return 0L ;" of the "case IDM_PAINTTEST_FILL:" statement:
case IDM_PAINTTEST_TEXT:OnText ( hWnd, pPaint ) ;return 0L ;
Compile and run the project by selecting Build->Execute tutorial.exe from the menu.