Howto: Enable Visual Styles in a VS2003 plugin or add-in

Tuesday, December 19, 2006 0 Comments

When you want to give XP visual style to a .NET application, you must call Application.EnableVisualStyles() method. But an additional call is needed, because a Framework bug. Some images in common controls under a ListView, are not shown. To avoid this bug you must use Application.DoEvents() after enable visual styles.

This is easy when you are developing a Windows standard application. But when you are developing a Visual Studio add-in (Visual Studio 2003) or a Office add-in, the perspective is different.

EnableVisualStyles is not compatible with Visual Studio 2003. It causes some crashes in the application. To enable XP visual styles, without affecting other applications, you can define an activation context, and the the XP themes affect only the appearance of your code.

http://support.microsoft.com/kb/830033

Here, there is more info about XP visual styles:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp

0 comentarios: