微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

带有图标或位图的 CMFCButton 仅显示截断文本?

如何解决带有图标或位图的 CMFCButton 仅显示截断文本?

为什么只显示 CMFCButton 截断的文本?

可以在 VS2019 中显示和重现,在 IDD_ABOUTBox添加按钮。

enter image description here

解决方法

我现在可以隔离、重现和修复问题。 (感谢 a.mole 的提醒)

如果您使用 Visual C++ 中的应用程序向导生成此项目,则您的 stdafx.h(或较新版本中的 framework.h)文件中可能包含以下几行:

#ifdef _UNICODE
  #if defined _M_IX86
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
  #elif defined _M_X64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
  #else
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
  #endif
#endif

enter image description here

一切都好!

现在,在我的旧项目中,我已经注释掉 ifdef _UNICODE 以在 MBCS 中也使用相同的清单。 https://stackoverflow.com/a/59631066/4303373

//#ifdef _UNICODE
  #if defined _M_IX86
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
  #endif
//#endif

enter image description here

结论:您不应更改 MS 生成的代码,这在未来版本中可能无法正常工作。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。