【问题标题】:Visual Studio 2010 MFC dialogs: Aero style?Visual Studio 2010 MFC 对话框:Aero 风格?
【发布时间】:2011-06-26 04:09:58
【问题描述】:

目前,我的 MFC 对话框看起来像来自 Windows 98。有没有办法让它使用活动的 Windows 7 样式(aero)?

(我使用的是 C++)

【问题讨论】:

    标签: visual-studio-2010 windows-7 mfc


    【解决方案1】:

    尝试将其添加到 Stdafx.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_IA64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' 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
    

    【讨论】:

    • 谢谢,这是一个很好的解决方案,现在我可以避免创建和嵌入清单的所有麻烦。刚刚在 Win32 应用程序上进行了测试,它按预期工作。
    • 我知道我迟到了两年,但这仍然适用于 MFC 应用程序。为小费干杯。
    • 使用多字节字符集而不是 unicode 的项目有希望吗?我没有设置 _UNICODE。
    • 嗨@masche - 基于this forum post,看起来多字节应用程序中的 v6 通用控件存在问题。有人在编辑控件中提到了一个问题,或者可能是CEditView。其他人说他们没有任何问题。您可以尝试将_UNICODE ifdef 注释掉并进行测试。
    【解决方案2】:

    您的应用程序中需要一个带有主题的清单,并确保执行 InitCommonControlsEx()。

    还可以查看 MFC 功能包,下面也是示例链接:

    【讨论】:

      【解决方案3】:

      确保向应用程序添加有效的清单。

      【讨论】:

      • 我已经在属性中启用了清单生成(默认情况下)
      • 生成清单并不意味着它指定了通用控件 6. 在 Visual Studio 的对象浏览器中通过文件 > 打开并查看检查当前清单资源。
      猜你喜欢
      • 1970-01-01
      • 2011-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-27
      • 1970-01-01
      • 2011-06-27
      相关资源
      最近更新 更多