15,979
社区成员
发帖
与我相关
我的任务
分享
CFontDialog fdlg;
if (fdlg.DoModal() == IDOK)
{
LOGFONT font;
fdlg.GetCurrentFont(&font);
CFont f;
f.CreateFontIndirect(&font);
SetFont(&f);
}
void CDKDlg::OnSetfont()CFontDialog fdlg;
if (fdlg.DoModal() == IDOK)
{
LOGFONT font;
fdlg.GetCurrentFont(&font);
CFont f;
f.CreateFontIndirect(&font);
GetRichEditCtrl().SetFont(&f);
CHARFORMAT cfm;
cfm.cbSize = sizeof(cfm);
GetRichEditCtrl().GetDefaultCharFormat(cfm);
cfm.crTextColor = fdlg.GetColor();
cfm.dwMask = CFM_COLOR;
cfm.dwEffects &=~CFE_AUTOCOLOR;
GetRichEditCtrl().SetSelectionCharFormat(cfm);
}
CFontDialog fdlg;
if (fdlg.DoModal() == IDOK)
{
LOGFONT font;
fdlg.GetCurrentFont(&font);
CFont f;
f.CreateFontIndirect(&font);
SetFont(&f);
CHARFORMAT cfm;
cfm.cbSize = sizeof(cfm);
GetRichEditCtrl().GetDefaultCharFormat(cfm);
cfm.crTextColor = fdlg.GetColor();
cfm.dwMask = CFM_COLOR;
GetRichEditCtrl().SetDefaultCharFormat(cfm);
}