成员存储对话框对象的特征的结构。
CHOOSEFONT m_cf;
备注
在构造 CFontDialog 对象之后,可以使用 m_cf 在调用 DoModal 成员函数之前修改对话框的各个方面。 有关此结构的更多信息,请参见。Windows SDK的 CHOOSEFONT。
示例
// The code fragment creates a font based on the information
// we got from CFontDialog::m_cf variable.
CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
// Create the font using the selected font from CFontDialog.
LOGFONT lf;
memcpy(&lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
CFont font;
VERIFY(font.CreateFontIndirect(&lf));
// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.TextOut(5, 5, _T("Hello"), 5);
dc.SelectObject(def_font);
// Done with the font. Delete the font object.
font.DeleteObject();
}
要求
Header: afxdlgs.h