{
#ifndef CF_INACTIVEFONTS
#define CF_INACTIVEFONTS 0x02000000L
#endif //CF_INACTIVEFONTS
//初始化字体结构体
LOGFONT lgFont={0};
//填充用于初始化LOFGONT
GetFont()->GetLogFont(&lgFont);
CFontDialog dlg(&lgFont,
0
| CF_INITTOLOGFONTSTRUCT //表示第一个参数有效
| CF_SCREENFONTS //屏幕字体
| CF_PRINTERFONTS //可以打印的字体
| CF_INACTIVEFONTS //隐藏的字体
| CF_EFFECTS //字体效果
| 0,
NULL, this);
if(dlg.DoModal())
{
dlg.GetCurrentFont(&lgFont);
COLORREF txtColor = dlg.GetColor();
TRACE(_T("Font(%s, %d), Color(%d)\n"),
lgFont.lfFaceName, lgFont.lfHeight, txtColor);
}
}
使用CFontDialog 选择字体
最新推荐文章于 2023-09-10 14:31:10 发布