使用CFontDialog 选择字体

    xiaoxiao2022-07-06  172

    { #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); } }

    最新回复(0)