怎样让VB的Command按钮像Windows中的按钮那样?

来源:百度知道 编辑:UC知道 时间:2024/05/19 15:40:47
VB按钮的样式太单调了,你看XP中弹出的对话框中的“确定”“取消”多好看,而VB只有很单调的...我不使用其他控件,也不用颜色改变,我只求按钮样式改变的源代码!谢谢!!!!!!

VB程序实现WindowsXP效果的界面

①:在你的窗体加入代码。如果是多个窗口,可以将此代码放到模块中。

代码如下:

'声明API函数

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="CompanyName.ProductName.Your