views:

175

answers:

1

Is there a way to have a windows form app hosted in IE use the 'look-and-feel' of the current OS/browser, similar to how everything looks when the app is run in the debugger? For instance I'm debugging in VS2008 and it looks great, but when I view the app in IE7 or IE8 on Vista or Win7 all the controls look like Netscape navigator circa 1996. Buttons, labels, scrollbars, datagrids etc, is there a general setting to change this?

I'm currently compiling for .Net 2.0.

Thanks.

+1  A: 

When you run the app in the debugger, it goes through your Program.cs.Main() method which call System.Windows.Forms.Application.EnableVisualStyles(). Are you coming in via some different entry point when hosting in IE? One that would not call System.Windows.Forms.Application.EnableVisualStyles() perhaps? If so, you can add the call to EnableVisualStyles()--just make sure it's only called once or it will puke on you. Wrap it in a Try-Catch and gulp any System.InvalidOperationException.

C-Pound Guru
Awesome! That did it, thanks.
Shizam