VB programming to implement Windows XP style interface

Source: Internet
Author: User
Tags implement win32

Although the Windows XP interface is very gorgeous. Unfortunately, the program we write with VB in addition to the menu and the appearance of the window is an XP style, other controls are still the usual style. I think, some programs XP under the style of XP, VB must also have the means to achieve XP style. Later, I saw an article on the Internet to introduce XML, and found an article on the Internet to achieve XP style, after their own practice, finally found the VB program to achieve XP style approach. In order to make other netizens do not walk like me such many detours, will this method write out, with everybody raise together!!

The specific implementation methods are as follows:

①: Add code to your form. If you are more than one window, you can place this code in the module.

The code is as follows:

'声明API函数
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
  Private Sub Form_Initialize()
  InitCommonControls
End Sub

Note: Do not write initcommoncontrols this sentence under the Form_Load () event, otherwise your form will not start. (Don't blame me for not telling you ~ ~ ~ ~ ~ ~ ~)

②: Create a. exe.manifest file with the same name as your. exe (if: if you finally compile a file named WindowXPStyle.exe, create a file named WindowXPStyle.exe.manifest), and this file must exist in and your EXE Files in the same directory.

Taking WindowXPStyle.exe as an example, the contents of this WindowXPStyle.exe.manifest document are as follows:

<?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="6595b64144ccf1df"
  language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

Save the above content as WindowXPStyle.exe.manifest. And the execution file is placed in a directory (be sure to remember).

So far, our program has been completed, but in the VB design environment to run is not to see the XP effect. Must be compiled into an executable file to run. (Because of this I tried not to know how many times, that VB program is not to achieve XP effect of it ~ ~, did not think must be compiled into the implementation of the file can).

The effect is as shown in the following illustration:

I believe you have seen the shortcomings, is placed in the frame control of the single far button some "trouble"! To work around this problem, you can place the radio button in the picture control (with the picture control as a container), and then place the picture control in the frame control.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.