下一页 1 2
虽然WindowsXP的界面非常华丽。但是令人遗憾的是,我们用VB写的程序除了菜单和窗口的外观是XP风格外,其他控件还是一如既往的是普通风格。我想,有的程序在XP下有XP的风格,VB也一定有办法实现XP的风格。后来笔者在网上看到一篇介绍XML的文章,又在网上找到了一篇实现XP风格的文章,经过自己的实践,终于找到了VB程序实现XP风格的办法。为了使其他的网友不至于走像我这样的多的弯路,将此办法写出来,与大家共同提高!! 具体的实现方法如下: ①:在你的窗体加入代码。如果是多个窗口,可以将此代码放到模块中。 代码如下:
'声明API函数 Private Declare Sub InitCommonControls Lib "comctl32.dll" () Private Sub Form_Initialize() InitCommonControls End Sub
作者:崔占民
Email:CuiZM@163.com
注意:千万不要在Form_load()事件下写InitCommonControls这句话,否则你的窗体会启动不了。(不要怪我没告诉你啊~~~~)
②:建立一个和你的.exe同名的.exe.manifest文件(假如:如果你最后编译好的文件名为WindowXPStyle.exe,则建立一个文件名为WindowXPStyle.exe.manifest的文件),并且此文件必须存在于和你Exe文件的同一目录下。
以WindowXPStyle.exe为例,则这个WindowXPStyle.exe.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="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="6595b64144clearcase/" target="_blank" >ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> |