XP themes in Word COM add-in

Hi,

Is it possible to add XP themes in a VB.net com add-in?
I know it’s possible in C#:

http://support.microsoft.com/default.aspx?scid=kb;en-us;830033#6
I can add the class to a separate C# project in my solution, but how do I use it in my VB.net add-in? In the example they use a wrapper, but how is that done in vb.net?
The C# wrapper:


using(new EnableThemingInScope(true ) ) { Form1 form1 =new Form1(); form1.CreateControl(); }

Thanks

Lars Hjort

[1065 byte] By [Hjort] at [2008-3-1]
# 1

Assuming you are running at least .NET Fx 1.1 you can try an easier approach - just call System.Windows.Forms.Application.EnableVisualStyles() before any of your winforms code is executed.

See this help topic:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpref/html/frlrfsystemwindowsformsapplicationclassenablevisualstylestopic.asp

People on the web (http://weblogs.asp.net/mspedding/archive/2004/04/05/107608.aspx) also recommend calling Application.DoEvents after the call to EnableVisualStyles, but I never ran into the crashes described there.

MishaShneerson at 2007-9-9 > top of Msdn Tech,Visual Studio Tools for Office,Visual Studio Tools for Office...