有点乱,慢慢看
Windows Forms Article... 
Using Windows XP Themes with Windows Forms
Windows XP has a new feature called themes. Themes are like skins for the OS, although Windows XP doesn't allow user definable themes. Themes support is provided by comctl6. To maintain the best app compatibility, an application must use a manifest file to explicitly specify that it wants to use comctl6 and themes.There are many Windows Forms controls which are only wrappers for the comctl controls. Many of these Windows Forms controls support different looks than the standard comctl5 control (such as a flat web look) and are drawn by the Windows Forms framework instead of by comctl. In order for these controls to pick up themes, these controls must have their FlatStyle property set to FlatStyle.System.So in order to use themed controls in your Windows Forms app, you must:
Set each control with a FlatStyle property to FlatStyle.System 
Create a manifest file to bind your app to comctl6. The sample manifest file below can be used to bind any app (managed or unmanaged) to comctl6. Just copy it to the location of the .exe and rename it to <app name>.exe.manifest. Below is a sample Windows Forms app that uses themes. To run it, just compile it to themes.exe and then copy the manifest file to the same location on your hard drive. Source  Manifest FAQ
Q: Why isn' FlatStyle.System the default for controls?A: Windows Forms controls allow some customizations which comctl controls do not support by default. Things such as setting background images and background colors aren't supported by comctl. FlatStyle.Standard allows these properties to be set and is the default.Q: How do I embed the manifest file in my .exe?A: A Win32 resource must be added to your .exe. The type of the resource must be "RT_MANIFEST" and the resource id must be "1". An easy way to do this is with Visual Studio.NET:1. Open your exe in VS (file -> open file)
2. Right click on it and select add resource
3. Click "Import..." from the dialog
4. Select your manifest file
5. In the "Resource Type" field, enter "RT_MANIFEST"
6. In the property grid, change the resource ID from "101" to "1".
7. Save the exe. 补充日期: 2001-09-17 13:45:01dotNET 程序奔向Window XP,体验绚丽的外表?   
关键字:
dotNET,Windows,XP,VS.NET 贴文时间
2001-9-16 17:12:17 文章类型: 
原作 给贴子投票 
投票  
 ccBoy   原作 出处:  
  
dotNET 程序奔向Window XP,体验绚丽的外表?
 
小气的神 2001-09-16
 
我的朋友中终于有忍不住开始安装Windows XP了,感觉是被华丽的界面诱惑。好像最近网上流传的一个Windows XP 2600的版本十分稳定而且不用激活(所以安装的人渐渐又多起来了haha)。由于要帮他安装一些外设,我也才可以做这样的实验,开始考虑将自己原来的一些dotNET程序向XP上迁移,特别是一些WinForm的程序,因为我想自己的程序也可以利用XP的华丽UI。
 
有关XP的版本有很多说法,有的说已经预装了dotNet Framework Beta2,有的说没有装,我想这主要是dotnet运行库没有Release前所必须考虑的,从Beta1到Beta2的变化就很大,这样对于操作系统的稳定性一定是有直接影响的。(这点也可以粉碎了一些人对WinXP和dotnet之间的遐想,他们总认为XP的某一部分是用dotnet写的) 事实上,我手上的这个零售版的也没有安装Framework Beta2运行库,当我把程序直接Copy过去时,是不能运行的。至于这个运行库有两种办法可以来解决(当然应该有无数种方法):
1.        在你的Visual Studio.NET Beta2 的组件更新的那张CD中有一个dotNetFramework目录里面有一个Setup.exe(17.3M)的执行文件,去XP下执行,然后再执行你的dotNET程序就可以了。
2.        大型或复杂一点的程序,你可以使用VS.NET 带的Setup and deployment功能来完全的做一个Setup程序来完成这个工作。具体的你可以:
1.  打开你要部署的dotnet程序.
2.  File->New-Project... 在打开的New Project对话框中
3.  左边选中Setup and Deployment Project 右边一栏选中 Setup Wizard 注意下面的路径和选项,选中加入目前你的项目中,而不是关闭。
4.  然后会有一个Wizard 出现从1 To 5 完后新的Project自动加入你的Sln中。(如果不是选择 Setup Wizard而选择 Setup Project那么可以在VS.NET右边的Sln Explorer View中点击 Project 然后在树状View中的Application Folder 右键选 Add Project Output...这样会弹出一个对话框中选Primary Output和Localized Resource两项表明你需要打包你的运行文件和一些资源文件)
5.  OK后重新编译你所有的Project 你可以在你Setup Project的Debug或Release输出目录中发现一个MSI文件。去XP中安装就可以了。
 
老实说第二种方法很破,抽取了几乎整个dotNET的运行库文件,所以尺寸奇大,一般都是15M以上。当然除此之外你还可以安装Framework Beta2 SDK或VS.NET 等方法来使XP带有DotNET的运行库。
 
之后我开始一些有意思的实验,将自己的WinForm程序带上XP的样子。前几天我在CSDN上看到有人讲述VC环境下如何适应XP的环境。我想DotNET也是可以的,甚至VB的程序也可以。总的感觉还可以,几乎说是很顺利。我要感谢www.godotnet.com。因为我是参照下面这篇文章来完成的。
http://www.gotdotnet.com/team/windowsforms/Themes.aspx
 
上面有具体的步骤和一些说明,我说一些具体的步骤吧:
 
1.  把你的WinForm中所有有FlatStyle属性的控件的值都设置成 System ,没有的就算了。
2.  编译你的程序成EXE文件
3.  如果你XP已有dotNET的运行库,copy你的EXE程序去XP中任一地方。
4.  准备一个和你运行文件相同的Manifest文件和你的EXE文件在一起, 这个文件那里都有, 内容也都几乎一样,主要是它的文件名一定要是”你的运行程序名.Manifest”,比如我的程序是Win2KToXP.EXE,那么这个文件一定要起名为:Win2KToXP.EXE.manifest (这个Manifest文件网站上有一个样本,后面我附带了一个我测试过的给大家,直接用网站上的那个好像有问题。)
5.  这篇文章还介绍了一种你可以将这个Manifest直接嵌入到EXE的方法,我也测试过OK的。(你可以在生成EXE来做这一步,修改时引入的类型别写错是:RT_MANIFEST,然后把资源类型从101改成1,保存搞掂。感觉这是一种不错的设计,当你决定自己的程序要在XP下运行了再做这一步,不过前提要保证你在第四步的方式中是成功的,不然修改完EXE后会导致整个程序不能运行)
 
总之这是一种很有趣的体验,如果你有相同的环境你可以试一下。
我在Windows 2000 ADV Server SP2 EN , VS.NET SP2 EN 完成自己的dotNET程序并且编译成EXE。确保XP已有运行库的情况下直接copy EXE文件去XP环境执行就可以了。
 
下面是屏幕的拷图:
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 
 
下面是Manifest的文件清单:
 
<?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="Win2KToXP.EXE"
   type="win32"
/>
 
<description>ccBoy</description>
<dependency>
  <dependentAssembly>
    <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
      language="*"
      processorArchitecture="*"
      publicKeyToken="6595b64144ccf1df"
     />
  </dependentAssembly>
</dependency>
</assembly>