This post originated from an RSS feed registered with .NET Buzz
by Jon Box.
Original Post: Windows XP: Enabling Visual Styles
Feed Title: Jon Box's Weblog
Feed URL: http://radio-weblogs.com/0126569/rss.xml
Feed Description: This is a log of my findings and amusements with .NET. I also present information on my presentations and others that I see.
In the near future, you will hear more about Visual Styles, a cool UI feature in Windows XP. This feature makes your WinForm applications look professional by doing just a few steps: 1) enable VisualStyles via various mechanisms and 2) set controls with a FlatStyle property to "System".
Enable Visual Styles In v1.1 of the .NET Framework, you can call EnableVisualStyles like the following:
This usage has issues as some of screens in an app that I did generated strange,sporadic runtime errors. When I commented the EnableVisualStyles line out, it worked fine. Some folks also prescribed to add a DoEvents before this as done in the sample. See http://www.syncfusion.com/faq/winforms/search/1046.asp for other thoughts and an example in C#.
Due to unsolved strange errors continuing, I finally went away from this and am using a manifest file. Its so easy because you just take the below text and put into a file with a name of YourApp.EXE.Manifest in your execution directory. That is all there is to it.
Setting the Controls Also, dont forget to change all controls that have a FlatStyle property to the System value. If you do this through the property window, it generates the following: Me.LabelGreeting.FlatStyle = System.Windows.Forms.FlatStyle.System