Home                 Articles                 Downloads                 Images                 Beta              Contact

Get Windows Xp Visual Style Controls in Vb.Net

Summary - How to get Xp like buttons, check boxes, radio buttons and progress bars in 2003
Published - June 05/2005
Last Updated - Aug 10/2009
Author - Sumedh


Visual Basic.Net 2003 does not include a simple way to create Xp visual style controls

Xp Style in

Fig 1 - Default appearance

To get Xp style controls in your application we need to create a manifest file.

Xp Style in

Fig 2 - After the manifest

This tutorial will teach you how to add an application manifest (a file used during the build process to specify a certain resource) which specifies that Comctl32.dll (version 6) should be used if its available. Comctl32.dll is responsible for changing the appearance of controls in your application.

Windows Xp ships with version 5 and version 6 of the same file. To get xp controls you need to bind the version 6 file with your application, this binding is done with the help of the manifest file. A manifest file is just a simple xml file which is included in your application.

Enough of this technical jargon, just tell me how to do it.

Create a new project.

1) Create a new project, we will call it "WindowsApplication1". Remember where you save it.

2) Now drag the following controls
3) Change the Button, Checkbox and RadioButton control's Flatstyle property to System.

4) Double click on the button and add the following code to its click event.
ProgressBar1.Value = 50
5) Your button's click event should look this.
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1Click

ProgressBar1.Value = 50
End Sub

6) From the Build Menu, click on Build WindowsApplication1

7) Click on Save All from the file menu.

8) Don't close the Solution.

Making the Manifest

1) Go to your bin directory of your project where you will see your executable.

2) Create a new text file in notepad with any name ( we will change the name later) in the same directory.

3) Copy, Paste the following code in the file. Incase you are lazy,  download the file from the bottom of the page.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
<description>Cool Trick</description>

4) Click on save from the file menu.

5) Rename the file to "WindowsApplication1.exe.manifest" without the double quotes.
    Note - If the name of your 'exe' is different, then use that name with the ".manifest" extension.

6) If you get a warning which says "Are you sure you want to change it?". Click on Yes.

7) Click on Start from the Debug Menu in Vb.Net. Your application will be in Xp style Controls.
    Click the button control to see the new look of the ProgressBar.

If your application does not look like the one in Figure 2 then you must have missed some step.
Make sure you have FlatStyle property of the controls to System.

Building the Manifest into your Executable

If you build your executable and give it to your friends, they won't be able to see the Xp style controls, unless you pass the manifest as well. To solve this problem we need to build the manifest in the executable.

1) In VB.Net select File -> Open -> File.
    Note - Save and close your previous solution first.

2) Find your executable you want to add the manifest to and open it.

Xp Style in

3) Right Click on WindowsApplication1.exe and click on Add Resource.

4) Click on Import button in the Add Resource Dialog box.

5) Find the Manifest file we created earlier and open it.
    Note - If you cant find the file check "Files of Type" and select All Files (*.*)

6) The Custom Resource Type dialog box will appear. Type  "RT_MANIFEST" (without quotes) in Resource Type:
Click on OK.

win Xp Style

7) Right click on 101 and select Properties. Set the following.
    ID = 1
    Language = Neutral

Sumedh Xp Style in

Xp Style in

8) Click on Save All from the File Menu.


With this simple tutorial we can now manipulate the appearance of buttons, checkboxes and radio buttons to look like those of Windows Xp.

Now you can give the executable to all your friends without the manifest file and it will still appear with Xp visual style.

Note - This will work only on Windows Xp only because earlier operating systems like Win 2000 and 98 cannot run Comctl32.dll. Your executable in those operating system will look like default.

If the theme in the Xp system is classic you wont be able to see Xp style controls.

Manifest File - 1Kb
Manifest File Download

Go to top Top

CopyRight  2007  Sumedh K