Click here to Skip to main content
13,895,892 members
Click here to Skip to main content
Add your own
alternative version


48 bookmarked
Posted 31 Oct 2003

Enabling Windows XP Visual Style UI for your C# applications

, 31 Oct 2003
Rate this:
Please Sign up or sign in to vote.
Enabling Windows XP Visual Style UI for your C# applications
  • Download demo project - 9 Kb

      Sample Image - XPStyleUI.jpg


      This article shows the technique of giving your C# Applications a Windows XP-like appearance.


      Recently when I developed my first C++ application using Visual Studio .NET I found that the TreeView and ListView controls looked somewhat similar to those found on Windows XP, the block for + and - had a 3d look and when I move the cursor on the column-headers of ListView a yellow border appears; since such a facility is not available in C# I decided to probe the C++ project to see if such a UI could be provided in C# and found the right information which allows to give C# applications XP Style look to controls, the method of doing so surprisingly turned out to be quite simple.


      This works in .NET 7.0 and 7.1 and Windows XP Operating System (not Windows 2000 or Windows 2003 Server); in Visual Studio .NET 7.1 the application object has a property Application.EnableVisualStyles().

      How To

      Using Visual Studio .NET wizard create a "Windows Application" , on the displayed form drop the following controls

      • CheckBox
      • RadioButton
      • Button

      Now Build Solution and Start your application, you will see no effect on the displayed window. Now open NotePad and mark and copy the code in the "Contents of Manifest file" section below the block within the border only and paste in the newly opened NotePad file and save the file with name "your_project_name".exe.manifest in "your_project"\bin\debug folder OR download the Demo zip and copy the included "WindowsApplication1.exe.manifest" file in the the above mentioned folder and rename it; now Start your project (no need to rebuild solution), you will still find no effect on the displayed Window, read the section "Setting Properties" to know more.

      You have to do a copy/pase operation since only select type of files can be posted in the article.

      Point to Note

      You can drop / copy the above Manifest file "WindowsApplication1.Exe.manifest" in the same location as your completed applications executable and rename the file to the "name of your application".Exe.manifest (without quotes) and remember to distribute this file along with the executable.

      Setting Properties

      Some of the controls in Visual Studion .NET have a property named FlatStyle, this property is set to "Standard" for these controls by default, you have to set this property to System for these controls to have a Windows XP Style look ("System" means that the Operating system is responsible setting for its Visual Style). below is a Table showing names of controls which have such property.


      Drawback of FlatStyle

      Setting Flatstyle to "System" prevents these controls from displaying Images, this possibly is the reason why this property has been added to these controls, if you intend to display images in any of these controls then you must set it to anything other then "System".

      Contents of Manifest file

      Below is the content of the Manifest file "WindowsApplications1.Exe.manifest", this file is in xml format and can be opened and edited using any text editor like notepad or wordpad, and you can add the name of your project in this file but it will not have any effect on the application

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


      This method of giving your applications a XP Style look does not embed the information in the manifest file in the completed applications, if the apps you develop are for in-house purposes or to clients you know personally this is the best approach, but if you are developing applications for unknown client's you can lookup the .NET utilities Application Linker (al.exe) and Strong Name (sn.exe) to embed information about your product in the applications executable, these utilities are generally run in a Dos-Console and have many switches to be set.


      • New Article.
    • License

      This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

      A list of licenses authors might use can be found here


      About the Author

      Barretto VN
      India India
      Nothing to boast about

      You may also be interested in...


      Comments and Discussions

      GeneralImporting manifest as a resource Pin
      RancidCrabtree10-Mar-07 8:17
      memberRancidCrabtree10-Mar-07 8:17 
      QuestionHow enable XP style form Contextmenu? Pin
      Member 173989414-Sep-05 7:42
      memberMember 173989414-Sep-05 7:42 
      Generalgreat resource for doing this Pin
      scottfm29-Nov-04 5:57
      memberscottfm29-Nov-04 5:57 
      Generalbutton.ForeColor doesn't work Pin
      Cong Dan8-Oct-04 16:59
      memberCong Dan8-Oct-04 16:59 
      GeneralRe: button.ForeColor doesn't work Pin
      Barretto VN10-Oct-04 22:31
      memberBarretto VN10-Oct-04 22:31 
      GeneralRe: button.ForeColor doesn't work Pin
      Cong Dan11-Oct-04 16:07
      memberCong Dan11-Oct-04 16:07 
      QuestionRe: button.ForeColor doesn't work Pin
      shobha02029-Mar-09 18:29
      membershobha02029-Mar-09 18:29 
      Generalthis style in visual C++ 6.0 Pin
      Anonymous7-Jun-04 15:43
      memberAnonymous7-Jun-04 15:43 
      GeneralRe: this style in visual C++ 6.0 Pin
      Barretto VN15-Jun-04 22:58
      memberBarretto VN15-Jun-04 22:58 
      GeneralDataGrid still not working Pin
      SchmidtND24-May-04 20:45
      memberSchmidtND24-May-04 20:45 
      GeneralRe: DataGrid still not working Pin
      Barretto VN25-May-04 3:19
      memberBarretto VN25-May-04 3:19 
      GeneralRe: DataGrid still not working Pin
      SchmidtND6-Oct-04 12:22
      memberSchmidtND6-Oct-04 12:22 
      QuestionHow to get XP style property page background. Pin
      Joel Matthias1-Nov-03 12:09
      memberJoel Matthias1-Nov-03 12:09 
      AnswerRe: How to get XP style property page background. Pin
      Heath Stewart2-Nov-03 10:48
      protectorHeath Stewart2-Nov-03 10:48 
      GeneralWindows 2003 Server Pin
      mogwai1-Nov-03 10:40
      membermogwai1-Nov-03 10:40 
      GeneralRe: Windows 2003 Server Pin
      mogwai1-Nov-03 10:45
      membermogwai1-Nov-03 10:45 
      GeneralRe: Windows 2003 Server Pin
      Houssam Alshami24-Sep-11 5:07
      memberHoussam Alshami24-Sep-11 5:07 
      GeneralAlready Posted Pin
      Heath Stewart1-Nov-03 5:32
      protectorHeath Stewart1-Nov-03 5:32 
      GeneralRe: Already Posted PinPopular
      Barretto VN1-Nov-03 20:30
      memberBarretto VN1-Nov-03 20:30 
      GeneralRe: Already Posted Pin
      Heath Stewart2-Nov-03 10:52
      protectorHeath Stewart2-Nov-03 10:52 
      GeneralRe: Already Posted PinPopular
      Derek Lakin2-Nov-03 21:16
      memberDerek Lakin2-Nov-03 21:16 
      GeneralRe: Already Posted Pin
      Heath Stewart3-Nov-03 2:40
      protectorHeath Stewart3-Nov-03 2:40 
      GeneralRe: Already Posted Pin
      Allan Wissing5-Nov-03 23:10
      memberAllan Wissing5-Nov-03 23:10 
      GeneralRe: Already Posted Pin
      Daniël Pelsmaeker18-Nov-03 5:32
      memberDaniël Pelsmaeker18-Nov-03 5:32 
      GeneralApplication.EnableVisualStyles is't OK Pin
      jGuzman1-Nov-03 3:47
      memberjGuzman1-Nov-03 3:47 

      General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

      Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

      Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
      Web01 | 2.8.190306.1 | Last Updated 1 Nov 2003
      Article Copyright 2003 by Barretto VN
      Everything else Copyright © CodeProject, 1999-2019
      Layout: fixed | fluid