mfc - 升级后的MFC应用程序看起来仍然很旧

标签 mfc visual-studio-2015 visual-c++-6

我有一个用VC6编写的MFC应用程序。我已经将其升级到VS2015,并且可以构建和运行。该应用程序是一个主要exe文件,其中包含许多具有对话框的DLL。

但是,该应用程序仍然看起来像是使用VC6构建的。没有一个GUI组件具有Windows 7的外观和感觉,它们仍然看上去都是旧样式。

如何使现有应用程序看起来更现代?

最佳答案

您至少应将此行添加到项目中,例如,将其添加到stdafx.h

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

或将以下内容添加到 list 文件中:
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>

另请参阅Enabling Visual Styles

对于所有者绘制控件而言,它变得更加复杂。请参阅此引用资料:
Using Visual Styles with Custom and Owner-Drawn Controls

对于ListView和TreeView控件,您可以调用此函数以获得更现代的外观(尽管在Windows 10中没有任何区别)
SetWindowTheme(m_ListView.m_hWnd, L"Explorer", NULL);
SetWindowTheme(m_TreeView.m_hWnd, L"Explorer", NULL);

* #pragma comment是特定于Visual Studio的。对于其他编译器,您需要修改 list 文件

关于mfc - 升级后的MFC应用程序看起来仍然很旧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32728815/

相关文章:

c# - UseSqlServer 未在 DbContextOptionBuilder 中定义

c - VC++获取头文件路径

c++ - 在 windows 10 上安装 visual studio 6

windows - 让我的 MFC 对话框在其控件之前接收击键事件(MFC/Win32 相当于 WinForms "KeyPreview")

c# - 如何从 kproj 引用 csproj

c# - 字符串编码错误(Windows 10 + Visual Studio 2015 + Net 4.6)

c++ - IHTMLDocument2::write() 的问题

c++ - 服务器多播 - MFC CSocket - C++ - 如何?

c++ - 利用计时器更新 MFC 文档/ View 应用程序

visual-c++ - mfc,任何人都可以帮忙设计一种喷枪算法吗,我只是不明白该怎么做