mfc 控件字体设置

时间:2022-06-18 04:45:20
将以下代码加入至 OnInitDialog() 中
// TODO: Add extra initialization here
CFont * m_font= new CFont;
m_font->CreateFont(18,0,0,0,0,0,0,0,GB2312_CHARSET,0,0,0,0,"宋体"); //定义IDC_STATIC的成员变量
CStatic * m_static = (CStatic *)GetDlgItem(IDC_STATIC);
//设置字体,false:不重画窗口
m_static->SetFont(m_font,false);