Dialog 在时间设计上具有现代外观,但在运行时具有旧外观(使用 Visual C++ 和资源编辑器) [英] Dialog has a modern look on time design , but old look on run time (using Visual C++ and resource editor)

查看:23
本文介绍了Dialog 在时间设计上具有现代外观,但在运行时具有旧外观(使用 Visual C++ 和资源编辑器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual C++ 的资源编辑器创建一个对话框.

I'm creating a dialog with the resource editor of Visual C++.

当我运行编辑器的测试按钮时,对话框的组件以现代外观显示,而在运行创建和显示对话框的应用程序时,它以旧外观显示......我只是在使用WINAPI 调用以显示对话框,而不是 MFC.

When I run the test button of the editor, components of the dialog are displayed with a modern look, while when running the application that creates and shows the dialog, it's displayed with an old look...I'm just using WINAPI calls to display the dialog, not MFC.

这是截图(上图是设计时的 UI 外观示例,另一张是运行时的 UI 外观):

Here are the screenshot (the upper image is an example of UI look on design time, the other one is the UI look on run time):

链接文字

有人知道我做错了什么吗?

Does anyone know what I'm doing wrong?

推荐答案

您的应用程序清单是否指定要使用 comctl32.dll 版本 6?这是使用视觉样式和更现代的外观 在 Windows XP 中.

Does your application manifest specify that you want to use comctl32.dll version 6? This is one of the requirements of using visual styles and a more modern look in windows XP.

创建清单并使您的应用程序能够使用视觉样式.

链接到 ComCtl32.lib 并调用 InitCommonControls(请参阅 MSDN 库中的平台 SDK 文档).

Link to ComCtl32.lib and call InitCommonControls (see the Platform SDK documentation in the MSDN Library).

将名为 YourApp.exe.manifest 的文件添加到具有以下 XML 格式的源代码树中:

Add a file called YourApp.exe.manifest to your source tree that has the following XML format:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 <assemblyIdentity
  version="1.0.0.0"
  processorArchitecture="X86"
  name="CompanyName.ProductName.YourApp"
  type="win32"
 />
 <description>Your application description here.</description>
 <dependency>
  <dependentAssembly>
   <assemblyIdentity
    type="win32"
    name="Microsoft.Windows.Common-Controls"
    version="6.0.0.0"
    processorArchitecture="X86"
    publicKeyToken="6595b64144ccf1df"
    language="*"
   />
  </dependentAssembly>
 </dependency>
</assembly>

将清单添加到您的应用程序的资源文件中,如下所示

Add the manifest to your application's resource file as follows

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest"

注意:当您将前一个条目添加到资源时,您必须将其格式化为一行.或者,您可以将 XML 清单文件与应用程序的可执行文件放在同一目录中.操作系统将首先从文件系统加载清单,然后检查可执行文件的资源部分.文件系统版本优先.

Note: When you add the previous entry to the resource you must format it on one line. Alternatively, you can place the XML manifest file in the same directory as your application's executable file. The operating system will load the manifest from the file system first, and then check the resource section of the executable. The file system version takes precedence.

这篇关于Dialog 在时间设计上具有现代外观,但在运行时具有旧外观(使用 Visual C++ 和资源编辑器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆