找回密码
 开放注册

QQ登录

只需一步,快速开始

微信登录

微信扫码,快速开始

搜索
查看: 693|回复: 0

VB程序实现XP效果的界面!

[复制链接]

18

主题

9

回帖

38

牛毛

初生牛犊

积分
38
QQ
发表于 2009-4-30 09:33:52 | 显示全部楼层 |阅读模式 来自 山西省忻州市
一:在你的窗体加入代码。如果是多个窗口,可以将此代码放到模块中。

  代码如下:
  Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
  Private Sub Form_Initialize()
  InitCommonControls
  End Sub

  注意:千万不要在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=".exe"
  type="win32"
  />
  <description>WindowsExecutable</description>
  <dependency>
  <dependentAssembly>
  <assemblyIdentity
  type="win32"
  name="Microsoft.Windows.Common-Controls"
  version="6.0.0.0"
  processorArchitecture="X86"
  publicKeyToken="6595b64***44ccf1df"
  language="*"
  />
  </dependentAssembly>
  </dependency>
  </assembly>

  将以上内容保存为WindowXPStyle.exe.manifest。并且和执行文件放在一个目录下.完成就是那么简单.
  '注意的地方:由于VB6自身的原因,Windows XP再一次给我们留了一些难题:
  一、工具栏问题:工具栏控件一定要用Microsoft Windows Common Controls 5.0,而不要用Microsoft Windows Common Controls 6.0。因为此InitCommonControls API函数是位于comctl32.dll(Microsoft Windows Common Controls 5.0控件的动态链接库中)。

  二、图形风格按钮的问题:很遗憾,我们不能再使用Graphical风格的命令按钮(即Style=1的命令按钮控件)了。因为一旦将命令按钮的Style属性设为1,那么它将失去Windows XP风格。
您需要登录后才可以回帖 登录 | 开放注册

本版积分规则

帮助|Archiver|小黑屋|通信管理局专项备案号:[2008]238号|NB5社区 ( 皖ICP备08004151号;皖公网安备34010402700514号 )

GMT+8, 2025-4-27 00:52 , Processed in 0.149508 second(s), 34 queries .

Powered by Discuz! X3.5

快速回复 返回顶部 返回列表