📄 fontfill.c
字号:
/*-----------------------------------------
FONTFILL.C -- Using Path to Fill Font
(c) Charles Petzold, 1998
-----------------------------------------*/
#include <windows.h>
#include "..\\eztest\\ezfont.h"
TCHAR szAppName [] = TEXT ("FontFill") ;
TCHAR szTitle [] = TEXT ("FontFill: Using Path to Fill Font") ;
void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
static TCHAR szString [] = TEXT ("Filling") ;
HFONT hFont ;
SIZE size ;
hFont = EzCreateFont (hdc, TEXT ("Times New Roman"), 1440, 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 (255, 0, 0))) ;
SetBkColor (hdc, RGB (0, 0, 255)) ;
SetBkMode (hdc, OPAQUE) ;
StrokeAndFillPath (hdc) ;
DeleteObject (SelectObject (hdc, GetStockObject (WHITE_BRUSH))) ;
SelectObject (hdc, GetStockObject (SYSTEM_FONT)) ;
DeleteObject (hFont) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -