您的位置:首页 > 其它

为.NET程序中的系统对话框启用XP外观

2010-06-02 13:01 260 查看
.NET程序中的有些对话框实际上是对Win32对话框的封装,比如MessageBox.在默认情况下,新建立的.NET程序中使用MessageBox.Show()打开MessageBox时,此对话框的样式为Windows2000风格:





若要启用XP/Visat/Win7系统的新风格,可以为程序添加一个manifest配置文件:

1.在.net项目中添加一个app.manifest配置文件:





2.打开所添加的app.manifest文件,找到系统控件风格配置代码:

1: <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
2:    <!--<dependency>
3:     <dependentAssembly>
4:       <assemblyIdentity
5:           type="win32"
6:           name="Microsoft.Windows.Common-Controls"
7:           version="6.0.0.0"
8:           processorArchitecture="*"
9:           publicKeyToken="6595b64144ccf1df"
10:           language="*"
11:         />
12:     </dependentAssembly>
13:   </dependency>-->


3.去掉dependentAssembly节点的注释标记,然后重新编译程序,即可启用新的系统控件外观风格:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: