Windows XP style without manifest

Just a quickie on the Windows XP style:

The .NET Framework 1.0 and 1.1 support Windows applications with Windows XP look. It will give this look to controls with the FlatStyle property set to System. To activate the Windows XP look you can create a manifest file and place that inside the folder of the executable assembly. As an alternative you can embed it as a resource inside the assembly.

The 1.1 Framework also has a method Application.EnableVisualStyles() that will allow you to work without a manifest file and still get the same results. This may lead to some weird behavior, though. You can expect a System.Runtime.InteropServices.SEHException from out of nowhere or missing images on toolbars and other controls. This is a known bug, that can be circumvented by calling Application.DoEvents() right after Application.EnableVisualStyles(), like so:

void Main()
  Application.Run(new Form1());

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s