.Net COM button style

HankSloka
HankSloka used Ask the Experts™
on
Hi

I'm in the process of writting a C# Com GUI for use in an old C++ V6 application.

The C# COM object creates a WinForm and shows it in a predefined place (making it look as if it's actually a C++ dialog)

Everything is working fine except that when I open the form, the buttons are no longer the nice C# .Net style wiht shading and rounded edges, but have changed to the old boring xp style square and gray background.

Same goes for the combo box if I choose the DropDownList style, so I assume the same goes for all the controls.

Is there some way to force the COM object to use the .Net style controls?

Cheers
Hank
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
You may be out of luck. :=(, in this case.
You can try to add the following line in the beginning of your C# code (Form_Load, or sub Main):

Application.EnableVisualStyles();
 
 But when I tried in the past to call it from VB6 app, I got an error. It's all fine if it's .NET to .NET.

Author

Commented:
Awesome!

That did the trick!!

Thanks, I spent ages trawling the internet.  Didn't want to come here and ask without doing a bit of research first.

Thanks
Hank

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial