Is EnableVisualStyles method to support XP styles in my app broken?

Microsoft has confirmed that calling EnableVisualStyles in the main method resulting in some ImageList corruption is a bug. There however seems to be a workaround posted by Martin Robins in the newsgroup which worksaround this issue: public virtual void Main() { Application.EnableVisualStyles(); // Calling DoEvents after the above method call seems to fix this issue: Application.DoEvents(); Application.Run(new Form1()); }

How do I determine which operating system is running

The Environment class in the System namespace has this information. [C#] string versionText = Environment.OSVersion.Version.ToString(); [VB.NET] Dim versionText As String = Environment.OSVersion.Version.ToString() The Version property has member properties such as Major and Minor that give additional information. Note that XP is windows version 5.1