WinForms apps and Windows XP visual styles

Posted: (EET/GMT+2)

 

I wanted to beef up some of my Delphi and C# application to take advantage of the Windows XP visual styles (the "Luna look"). I recalled from old that one should write an XML based manifest file, and I also found good info from 2002 how to do just that.

Luckily, there's an easier way as well: the Application.EnableVisualStyles method. There are many reports on the 'net that this method doesn't work properly, but I got it working easily -- until one point in time. That is, suddenly the visual styles didn't work at all. It seems to me that the method works well on very small applications, but not on larger ones.

However, there is an easy fix for this: just call the DoEvents method of the same class. This should fix the problems you have. Maybe in the final version of .NET 2.0 you don't need to do even that!