您的位置:首页 > 其它

设置MFC控件字体【转】

2011-05-22 17:12 267 查看
//设置标题字体
CFont *pFont = m_name.GetFont();



LOGFONT pLogFont;
//TRACE( "Font:%p/n ",pFont);
pFont-> GetLogFont(&pLogFont);

LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT));
lf.lfHeight =pLogFont.lfHeight*2;
lf.lfCharSet=pLogFont.lfCharSet;
//strcpy((char*)(LPWTRSTR)lf.lfFaceName,(char*)(LPWTRSTR)pLogFont.lfFaceName);
lstrcpy(/*(LPSTR)*/lf.lfFaceName/*LogFont.lfFaceName*/,(LPCWSTR)"黑体"/*"楷体_GB2312"*/);
lf.lfWeight=700;
lf.lfWidth=12;
lf.lfHeight=30;
CFont *pNewFont =new CFont;
pNewFont-> CreateFontIndirect(&lf);



m_name.SetFont(pNewFont);
m_name2.SetFont(pNewFont);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: