combox的ITEM设置不了字体的BUG
来源:互联网 发布:风油精滴在b 知乎 编辑:程序博客网 时间:2024/09/21 09:04
Combo控件的itemfont属性, 可以设置点击Combo弹出列表中的item的字体. 但是发现点击后, 弹出的列表里, 字体不是我们设置的.
查看源代码, 可以发现Combo弹出的列表是个新窗口, 该窗口的CPaintManagerUI成员(m_pm)调用了这句m_pm.UseParentResource(m_pOwner->GetManager()); ,虽然这个新窗口没有自己的字体, 但它可以使用父窗口资源.
经过代码跟踪, 发现CPaintManagerUI::GetFont没有获取到正确的字体,
原来的代码是:
HFONT CPaintManagerUI::GetFont(int index){ if( index < 0 || index >= m_aCustomFonts.GetSize() ) return GetDefaultFontInfo()->hFont; TFontInfo* pFontInfo = static_cast<TFontInfo*>(m_aCustomFonts[index]); return pFontInfo->hFont;}
需要改成如下
HFONT CPaintManagerUI::GetFont(int index){ if( index < 0 || index >= m_aCustomFonts.GetSize() ){if (m_pParentResourcePM) return m_pParentResourcePM->GetFont(index);return GetDefaultFontInfo()->hFont;} TFontInfo* pFontInfo = static_cast<TFontInfo*>(m_aCustomFonts[index]); return pFontInfo->hFont;}
可以看到修改部分所做的工作是: 当找不到字体时, 使用父窗口资源字体.
改完后, 我们发现虽然字体对了, 不过ITEM的高度不对, 继续跟踪, 发现还需要修改TFontInfo* CPaintManagerUI::GetFontInfo(int index), 其实也是同样的BUG
2 0
- combox的ITEM设置不了字体的BUG
- QT 字体设置的bug
- combox的Item添加数组的方法
- MenuItemFont字体设置bug的解决方法
- 枚举系统字体的COMBOX例子
- ComBox中item的添加与取值方法
- UITabbar 中的 item的字体颜色 item点击后的tint颜色 和图片颜色的修改 UINavigationBar字体设置
- ComBox的属性设置为Drop Down
- winform动态设置combox的值
- DWZ select combox 级联中遇到的一个bug
- 为什么程序员发现不了自己的BUG
- 为什么程序员发现不了自己的BUG?
- 为什么程序员发现不了自己的BUG
- 为什么程序员发现不了自己的BUG
- 为什么程序员发现不了自己的BUG
- 为什么程序员发现不了自己的BUG?
- android Spinner控件设置下拉状态的条目item字体颜色
- ToolBar修改menu item的字体颜色
- 我加入了http://my.oschina.net/u/2330384
- Kerberos认证流程详解
- 骁龙810对比Tegra X1 主攻市场略有不同
- android wifi开发
- 利用android sdk 下的adb程序捕获手机log日志
- combox的ITEM设置不了字体的BUG
- 如何使用TestFlight进行Beta测试
- ava.lang.OutOfMemoryError: GC overhead limit exceeded
- 推荐30款最佳的数据可视化工具
- UVa 1646 - Edge Case(斐波那契+大整数)
- 使用java poi 读取excel文件
- Browser 架构
- ThunderGap隐私政策
- Git忽略当前已经更改的文件