开启程序的Visual Styles
首先看看MS对Visual Styles的解释:
Windows XP and later operating systems support a feature called visual styles that enables the appearance of common controls to change based on the theme chosen by the user. Prior to Windows 8, you must specifically configure your application to use visual styles; otherwise, the application's common controls are always rendered in the style associated with the Windows Classic theme, regardless of the currently selected theme. In Windows 8, visual styles can't be turned off, Windows Classic mode no longer exists, and high contrast mode has been modified to work with visual styles.
XP以后的系统支持一种叫做可视化风格的界面,界面可以随着系统的主题改变而变化。程序必须明确的去启用这种风格,否则程序就是经典风格界面 ,程序界面不随系统主题而改变。win8还新增了一种高对比度模式的界面,暂不讨论。
http://msdn.microsoft.com/en-us/library/windows/desktop/bb773187(v=vs.85).aspx
可以明显感觉visual styles要圆润漂亮了很多
开启 Visual Styles的方法
要使用 Visual Styles,需要第六版或更新的的ComCtl32.dll, ComCtl32.dll不重发行,只是预置在系统当中。xp以后的系列都同时有第五版和第六版的
ComCtl32.dll,第六版的ComCtl32.dll包含user controls and the common controls。默认情况下程序使用定义在User32.dll中的user controls 和定义在第五版 ComCtl32.dll 中的 common controls
comCtl32.dll版本介绍
| ComCtl32.dll | |
|---|---|
| Version | Distribution Platform |
| 4.0 | Windows 95 and Microsoft Windows NT 4.0 |
| 4.70 | Internet Explorer 3.0 |
| 4.71 | Microsoft Internet Explorer 4.0 |
| 4.72 | Microsoft Internet Explorer 4.01 and Windows 98 |
| 5.80 | Windows 98 Second Edition and Microsoft Internet Explorer 5 |
| 5.81 | Windows Millennium Edition (Windows Me), Windows 2000, Microsoft Internet Explorer 5.01, Microsoft Internet Explorer 5.5, and Microsoft Internet Explorer 6 |
| 5.82 | Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, and Windows 7 |
| 6.0 | Windows XP, Windows Server 2003 |
| 6.10 | Windows Vista, Windows Server 2008, and Windows 7 |
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298349(v=vs.85).aspx
@:添加程序清单的方法1
- <?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="*"
- name="CompanyName.ProductName.YourApplication"
- type="win32"
- />
- <description>Your application description here.</description>
- <dependency>
- <dependentAssembly>
- <assemblyIdentity
- type="win32"
- name="Microsoft.Windows.Common-Controls"
- version="6.0.0.0"
- processorArchitecture="*"
- publicKeyToken="6595b64144ccf1df"
- language="*"
- />
- </dependentAssembly>
- </dependency>
- </assembly>
| Attribute | Description |
|---|---|
| version | Version of the manifest. The version must be in the form major.minor.revision.build (that is, n.n.n.n, where n <=65535). |
| processorArchitecture | Processor for which your application is developed. |
| name | Includes company name, product name and application name. |
| type | Type of your application, such as Win32. |
dependency段 assemblyIdentity 元素的属性集
| Attribute | Description |
|---|---|
| type | Type of the dependency component, such as Win32. |
| name | Name of the component. |
| version | Version of the component. |
| processorArchitecture | Processor that the component is designed for.指定处理器。有效值为 msil、x86、IA64 和 amd64。 |
| publicKeyToken | Key token used with this component. |
| language | Language of the component. |
@:添加程序清单的方法2
在vs2005以后,设置visual styles可以不需要程序部署清单文件,而只是发送一个编译指令。在“stdafx.h”中添加一下几行就可以了
- #pragma comment(linker,"\"/manifestdependency:type='win32' \
- name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
- processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
MSND上说还需
- <span style="white-space:pre"> </span>// 如果一个运行在 Windows XP 上的应用程序清单指定要
- // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
- //则需要 InitCommonControlsEx()。否则,将无法创建窗口。
- INITCOMMONCONTROLSEX InitCtrls;
- InitCtrls.dwSize = sizeof(InitCtrls);
- // 将它设置为包括所有要在应用程序中使用的
- // 公共控件类。
- InitCtrls.dwICC = ICC_WIN95_CLASSES;
- InitCommonControlsEx(&InitCtrls);
但是发现不添加也没事,xp也可正常实现,懂得可以给说说
@:关闭Visual Styles
- #include "Uxtheme.h"
- #pragma comment(lib,"UxTheme.lib")
- SetWindowTheme(hwnd, L" ", L" ");
2:也可以调用InitInstance之前调用void SetThemeAppProperties( DWORD dwFlags),不设置 STAP_ALLOW_NONCLIENT 标志可关闭整个程序所有窗口的的Visual Styles
- #include "Uxtheme.h"
- #pragma comment(lib,"UxTheme.lib")
- DWORD dwFlags = (STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT);
- SetThemeAppProperties(dwFlags);
http://blog.csdn.net/x356982611/article/details/18403869
开启程序的Visual Styles的更多相关文章
- 使用 ODBC .NET 提供程序和 Visual C# .NET 执行 SQL 参数化存储过程
http://support2.microsoft.com/kb/310130/zh-cn 此分步指导文章描述如何使用 ODBC .NET 托管提供程序和 Visual C# .Net 调用参数化 S ...
- 怎么用visual studio2010编写c++程序|用visual studio2010编写c++程序的步骤
如何通过visual studio 2010编写一个简单的c++程序,随小编不一起看看如何编写. 首先打开visual studio 2010 点击软件左上角“文件-新建-项目”,选择“win32-w ...
- ASP.NET Core 中文文档 第二章 指南(1)用 Visual Studio Code 在 macOS 上创建首个 ASP.NET Core 应用程序
原文:Your First ASP.NET Core Application on a Mac Using Visual Studio Code 作者:Daniel Roth.Steve Smith ...
- ASP.NET Core 中文文档 第二章 指南(3)用 Visual Studio 发布一个 Azure 云 Web 应用程序
原文:Getting Started 作者:Rick Anderson 翻译:谢炀(Kiler) 校对:孟帅洋(书缘).刘怡(AlexLEWIS).何镇汐 设置开发环境 安装最新版本的 Azure S ...
- 用于 Visual Studio 和 ASP.NET 的 Web 应用程序项目部署常见问题
https://msdn.microsoft.com/zh-cn/library/ee942158(v=vs.110).aspx#can_i_exclude_specific_files_or_fol ...
- 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序
原文 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序 在 Visual Studio 2010 中开发和部署 Windows Azure 应用程序 Jim ...
- Visual Studio 2015中使用gdb远程调试linux程序
VS的debug功能非常强大,相比而言linux上的图形化调试一直不是很好用. 如果可以使用VS来调试linux程序,应该是一件比较愉快的事情. 这在2015中变得可能,因为从2015开始VS支持An ...
- 【Visual Studio - Dependency Walker】查找程序依赖的动态链接库文件(转)
原文转自 http://163n.blog.163.com/blog/static/5603555220113151113287/ 有时我们需要知道一个程序依赖哪些动态链接库(DLL)文件.实际上,有 ...
- 使用Visual Studio Code创建第一个ASP.NET Core应用程序
全文翻译自:Your First ASP.NET Core Application on a Mac Using Visual Studio Code 这篇文章将向你展示如何在Mac上写出你的第一个A ...
随机推荐
- 高级特性(6)- 高级Swing
6.1 列表 6.1.1 JList构件 6.1.2 列表模式 6.1.3 插入和移除值 6.1.4 值的绘制6.2 表格 6.2.1 简单表格 6.2.2 表格模型 6.2.3 对行和列的操作 6. ...
- 获取CPU序列号
public string GetCPUSerialNo() { string cpuSerialNo = string.Empty; ManagementClass managementClass ...
- Java基础03 构造器与方法重载
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 在方法与数据成员中,我们提到,Java中的对象在创建的时候会初始化(initial ...
- 怎样学好C++语言
昨天写了一篇怎样学好C语言,就有人回复问我怎样学好C++,所以,我把我个人的一些学习经验写在这里,希望对大家实用.首先,由于怎样学好C语言中谈到了算法和系统,所以这里就仅仅谈C++语言. C++是最难 ...
- Struts 2最新0day破坏性漏洞(远程任意代码执行)等的重现方法
Struts 2的远程任意代码执行和重定向漏洞,是这两天互联网上最重大的安全事件,据说国内互联网企业中,很多电商纷纷中招,应该已经有大规模的用户隐私泄露.这里我们简单总结下怎样在自己机子上重现这些漏洞 ...
- linux环境 :Linux 共享库LIBRARY_PATH, LD_LIBRARY_PATH 与ld.so.conf
参考: 1. Linux 共享库:LD_LIBRARY_PATH 与ld.so.conf Linux环境变量名,该环境变量主要用于指定查找共享库(动态链接库)时除了默认路径之外的其他路径.(该路径在默 ...
- window.name 跨域
跨域的由来 JavaScript出于安全方面的考虑,不允许跨域调用其他页面的对象.但是我们常常会遇到无法避免跨域的情况,如普通文章站点(article.xxx.com)需要评论,而评论站点却在chea ...
- EasyUI - Tabs
代码: 判断是不是已经存在,如果存在,则直接选中,否则创建新的tab. $('#tabs').tabs({ fit: true, border: false }) $('#Tree').tree({ ...
- 几十篇GDI以及MFC自绘的文章
http://www.cnblogs.com/lidabo/category/434801.html
- boost:asio编译
参考:http://hi.baidu.com/need_for_dream/blog/item/c14a28086a504c33e92488b5.html 环境: VS2010, boost1.38. ...