在CMainFrame.h中添加成员变量:CFont m_fontCustom;
在onCreat()方法结束之前的任一个位置写下下测方法即可
方法1:
{
// Create custom font:
LOGFONT lf;
globalData.fontRegular.GetLogFont(&lf);
lf.lfItalic = TRUE;
lf.lfHeight = 30;//(int)(1.25 * lf.lfHeight);
m_fontCustom.CreateFontIndirect(&lf);
}
void CMainFrame::UpdateRibbonFont()
{
m_wndRibbonBar.CloseAllPopupWindows();
m_wndRibbonBar.SetFont(&m_fontCustom);//cata区域字体
m_wndStatusBar.SetFont(&m_fontCustom); //状态栏字体
}
方法2:
{
CFont *font = m_wndRibbonBar.GetFont();
LOGFONT lf;
font->GetLogFont(&lf);
lf.lfHeight = 30;
_tcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("新宋体"));
m_fontCustom.CreateFontIndirect(&lf);
m_wndRibbonBar.SetFont(&m_fontCustom);
m_wndRibbonBar.SetFont(&m_fontCustom);
}
效果如下所示: