Visual studio 2008/2010 MFC程序Menu、Toolbar字体偏小解决办法

首先,这是一个MFC的Bug
http://connect.microsoft.com/VisualStudio/feedback/details/505466/mfc-visual-style-font-size-too-small-to-display-chinese-character-clearly-on-windows-xp

     MFC visual style font size too small to display chinese character clearly on Windows XP   When A MFC application which use visual style run on Windows Xp,the chinese character in menu and the tab item of output window can not display clearly.The chinese character in the tab item of output window can not display clearly even if it run on vista.

    AFX_GLOBAL_DATA::UpdateFonts should be modified to increase the min font height. For example,the LOGFONT::lfHeight of Tahoma can not be less then -12 or +13 if you want to diplay chinese character clearly.


解决时间暂时还不确定, 临时的方案如下:
AppInitInstance中加入:
LOGFONT logfont = {0};
:: SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &logfont, 0);
afxGlobalData.SetMenuFont(&logfont,true);

注释:
字体的设置保存在一个全局变量afxGlobalData中,此变量定义AfxGlobals.h中。
AFX_GLOBAL_DATA中有一个SetMenuFont可以设定字体属性,影响 Menu、Toolbar、Dock Pane等的caption字体。
但是这个设置对 tooltip无影响,临时解决:在上面代码基础上在加入
if(afxGlobalData.fontTooltip.GetSafeHandle() != NULL)
 {
  ::DeleteObject(afxGlobalData.fontTooltip.Detach());
 }
 afxGlobalData.fontTooltip.CreateFontIndirect(&logfont);

ps:经尝试,依然无法改变输出窗口的字体问题,期待更加完美的解决方案,最好还是微软感觉补丁一下....
个人觉得是不是应该把这段程序放在MainFrm的PreCreateWindow函数里面...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值