//FontFill.cpp
#include
#include "ezfont.h"
void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
TCHAR EnvName[]="ComputerName" ;
TCHAR szString [20] = TEXT ("NoNamefound") ;
HFONT hFont ;
SIZE size ;
GetEnvironmentVariable( EnvName, szString, 80) ; //È¡»·¾³±äÁ¿µÄÖµ
hFont = EzCreateFont (hdc, TEXT ("Times New Roman"), 1200, 0, 0, TRUE) ;
SelectObject (hdc, hFont) ;
SetBkMode (hdc, TRANSPARENT) ;
GetTextExtentPoint32 (hdc, szString, lstrlen (szString), &size) ;
BeginPath (hdc) ;
TextOut (hdc, (cxArea - size.cx) / 2, (cyArea - size.cy) / 2,
szString, lstrlen (szString)) ;
EndPath (hdc) ;
SelectObject (hdc, CreateHatchBrush (HS_DIAGCROSS, RGB (0, 255, 255))) ;
SetBkColor (hdc, RGB (255, 0, 0)) ;
SetBkMode (hdc, OPAQUE) ;
StrokeAndFillPath (hdc) ;
DeleteObject (SelectObject (hdc, GetStockObject (WHITE_BRUSH))) ;
SelectObject (hdc, GetStockObject (SYSTEM_FONT)) ;
DeleteObject (hFont) ;
}[DISABLELBCODE] |