设置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);
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);
相关文章推荐
- 【MFC系列】MFC快速设置控件文本字体、大小、颜色、背景
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- MFC对话框中控件字体颜色的设置
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- MFC视图中字体设置及控件添加
- MFC 使用static控件显示时间 并设置控件的字体格式和颜色
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- MFC——设置控件文本字体、大小、颜色、背景
- 设置控件背景色和字体颜色!!mfc
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- OnCtlColor函数:MFC设置静态文本框,编辑框等控件背景和字体颜色
- MFC窗口各控件的颜色和字体的设置
- MFC设置静态文本框,编辑框等控件背景和字体颜色
- MFC如何给控件设置字体
- MFC窗口各控件的颜色和字体的设置
- MFC可以设置字体名称、大小、字体前景色、背景色的Static控件
- MFC中设置static text控件的背景色、字体、字号和颜色