主要用到CreateFont,函数声明如下:
INGDIAPI HFONT WINAPI CreateFontA( _In_ int cHeight, //字体高度:0为默认高度,非0绝对值为字体高度
_In_ int cWidth, //字体宽度
_In_ int cEscapement, //文本行的倾斜度
_In_ int cOrientation, //字符基线的倾斜度
_In_ int cWeight, //字体的粗细
_In_ DWORD bItalic, //字体是否为斜体
_In_ DWORD bUnderline, //字体是否带下划线
_In_ DWORD bStrikeOut, //字体是否带删除线
_In_ DWORD iCharSet, //字体的字符集
_In_ DWORD iOutPrecision, //字符的输出精度
_In_ DWORD iClipPrecision, //字符裁剪的精度
_In_ DWORD iQuality, //字符的输出质量
_In_ DWORD iPitchAndFamily, //字符间距和字体族(低位说明间距,高位说明字符族)
_In_opt_ LPCSTR pszFaceName //字体名称
);
代码示例:
CFont *m_Font;
m_Font = new CFont;
m_Font->CreateFont(20, 8, 0, 0, 60,
FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_SWISS, "Arial");
m_NowTime.SetFont(m_Font, FALSE);
m_Status.SetFont(m_Font, FALSE);