The VB program implements the interface of WindowsXP effect!!

zhaozj2021-02-16  52

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! !

The program source code can be downloaded on my website: http://www.j2soft.cn/

Author: Cui Zhanmin

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 into 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).

The operation is as shown in the following figure:

I believe that everyone has also seen the deficiencies, just put a single "trouble" in the Frame control! To resolve this issue, you can play the radio button in the Picture control (as a container as a container), then place the Picture control in the Frame control, it is possible.

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.

As long as you pay attention to the above points, and take the corresponding measures, the program written by VB is still very gorgeous in Windows XP! As shown below:

Note: The procedures written in other languages ​​are the same, and there is no VB so much problem. Such as Delphi, VC, etc., even the API function can be used directly, without prior declaration. Relatively speaking simpler!

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

New Post(0)