The VB program implements the interface of WindowsXP effects

xiaoxiao2021-03-06  39

Although the interface of WindowsXP is very gorgeous. But unfortunately, we use VB written programs in addition to the menu and window, other controls are as usual, as they are ordinary style. I think some programs have XP style in XP, and VB must have a way to realize the style of XP. Later, I saw an article introducing XML's article online, I found an article on the XP style. After my own practice, I finally found the VB program to implement XP style approach. In order to make other netizens not walk like me, write this way, and we will improve our common! ! Author: Cuizhan Min Email: CuiZM@163.com

The specific implementation is as follows:

1: Add code to your form. If you are multiple windows, you can place this code in the module. code show as below:

'Declaration API function

Private Declare Sub INITCOMMONCONTROLS LIB "COMCTL32.DLL" ()

Private sub flow_initialize ()

INITCOMMONCONTROLS

End Sub

Note: Don't write initcommonControls in the form_load () event, otherwise your form can't start. (Don't blame, I didn't tell you ~~~~)

2: Create a .exe.manifest file with your .exe. Must exist in the same directory with your EXE file.

Take WindowxPStyle.exe as an example, the contents of this window xpstyle.exe.manifest are as follows:

Version = "1.0.0.0"

Processrarchitecture = "x86"

Name = "CompanyName.ProductName.yourapp"

TYPE = "Win32"

/>

Your Application Description Here.

TYPE = "Win32"

Name = "Microsoft.Windows.common-Controls"

Version = "6.0.0.0"

Processrarchitecture = "x86"

PublickeyToken = "6595b64144ccf1df"

Language = "*"

/>

Save the above content as WindowxpStyle.exe.Manifest. And in the execution file in a directory (must remember). So far, our program has been completed, but the XP effect is not seen in the VB design environment. It is necessary to compile into an executable to run. (Because this I have tried, I don't know how much, I think that the VB program does not implement the XP effect ~~ I didn't expect to compile into execution files).

Frequently Asked Questions and Precautions

Due to VB6 itself, Windows XP has left some problems once again:

I. Toolbar Problem: Toolbar Controls must use Microsoft Windows Common Controls 5.0 without using Microsoft Windows Common Controls 6.0. Because this INITCOMMONCONTROLS API function is located in chactl32.dll (Microsoft Windows Common Controls 5.0 control).

Second, the problem of graphic style buttons: Unfortunately, we cannot use the Graphical style command button (ie style = 1 command button control). Because once the style property of the command button is set to 1, then it will lose Windows XP style.

转载请注明原文地址:https://www.9cbs.com/read-75918.html

New Post(0)