richedit2.0 設置英文字符字體
richedit 2.0 引入了新的一個特性 IMF_AUTOFONT。設置了這個屬性后當鍵盤布局改變后richedit 會自動的設置適合當前布局的字體和字符集。所以在richedit中調用
SendMessage( EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&crf);
或會發現對中文字符設置的字體生效的,但是英文字符未生效。
可以去掉這個屬性:
// 去掉 richedit2.0 默認設置了的 autofont
BOOL CNetRichEditCtrl::DisableAutoFont()
{
DWORD dwLanOptions = SendMessage(EM_GETLANGOPTIONS,0,0);
if (dwLanOptions&IMF_AUTOFONT)
{
dwLanOptions = dwLanOptions&~IMF_AUTOFONT;
SendMessage(EM_SETLANGOPTIONS,0,dwLanOptions);
return TRUE;
}
return FALSE;
}
BOOL CNetRichEditCtrl::DisableAutoFont()
{
DWORD dwLanOptions = SendMessage(EM_GETLANGOPTIONS,0,0);
if (dwLanOptions&IMF_AUTOFONT)
{
dwLanOptions = dwLanOptions&~IMF_AUTOFONT;
SendMessage(EM_SETLANGOPTIONS,0,dwLanOptions);
return TRUE;
}
return FALSE;
}
posted on 2012-09-13 11:53 zaccheo 閱讀(830) 評論(0) 編輯 收藏 引用 所屬分類: C++ 、win32/MFC