How can I use XP Themes with Windows Forms using the .NET FrameWork 1.0?

Platform: WinForms| Category: Tips

Follow these steps to introduce Windows XP visual styles into your Windows application.

1. Create a new Windows Application and add some controls to the default form.

2. For every control you place on the form that has a FlatStyle property, set the property to System.

3. Compile your application.

4. Build a manifest file in the application directory. NOTE: This manifest file must be located in the same directory as the executable. Open Notepad and place the code shown below in the file.


<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
   <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
   <description>.NET control deployment tool</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 file in the application directory with the name of the
application and an extension of exe.manifest. For instance, if your application name is ‘MyApp’, you will name the manifest file as MyApp.exe.manifest.

5. When your application runs, Windows XP looks at the application manifest which tells the operating system to use common controls library version 6.0.

This process is discussed and a sample given in an article by the David C. Brown on the Windows Forms team at MSDN.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.