void CDemoDlg::OnFormatFont()
{
// TODO: 在此添加命令处理程序代码
CHARFORMAT cf = {0};
cf.cbSize = sizeof(cf);
m_edtContent.GetSelectionCharFormat(cf);
CFontDialog dlg(cf);
if(dlg.DoModal() == IDOK)
{
dlg.GetCharFormat(cf);
m_edtContent.SetSelectionCharFormat(cf);
}
}
void CDemoDlg::OnFormatColor()
{
// TODO: 在此添加命令处理程序代码
CHARFORMAT cf = {0};
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_COLOR;
m_edtContent.GetSelectionCharFormat(cf);
CColorDialog dlg(cf.crTextColor);
if(dlg.DoModal() == IDOK)
{
cf.crTextColor = dlg.GetColor();
cf.dwEffects = 0;
m_edtContent.SetSelectionCharFormat(cf);
}
}