Enable a .NET app with XP Visual Styles

If you use Visual Studio.NET 2003 and have a WinForms application and you want to add Windows XP Visual Styles, or theme, to the application, do this:

In the main() function, add:

Application.EnableVisualStyles();
Application.DoEvents();

Like this example:

static void Main()
{
     Application.EnableVisualStyles();
     Application.DoEvents();
     Application.Run(new MainForm());
}

Remember to add those two lines before creating the main form. Don’t forget the DoEvents() function there or you’ll have problems with ImageLists. Or so I read !

Ofcourse, using a Manifest is the best option yet. Worked for me with Delphi, VB and such. There is also a .NET add-in available that claims to insert a Manifest file into your executable at compile-time. Sounds good but I haven’t tried it yet.

  • Share/Bookmark

2 Comments

AnonymousNovember 25th, 2004 at 9:51 pm

Nice! We rather appreciated the website

ARUNAugust 24th, 2005 at 2:14 pm

IT Was Very Good

Leave a comment

Your comment