Link to home
Start Free TrialLog in
Avatar of KBanner
KBanner

asked on

XP Style

Hi all,

first off thanks for clicking,

I have added some third party controls from Janus that allow an XP Theme to be set if the system running is Windows XP.

This creates a non standard look when these Combo boxes etc. are put on the same form as standard VB.NET Textboxes and Buttons.

Does anybody know how to make Standard Textboxes and Buttons XP style??
SOLUTION
Avatar of Joe_Griffith
Joe_Griffith

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just execute this line of code in your initialization routine:

Application.EnableVisualStyles

That turns on XP styles for the controls if the OS is XP.
Avatar of Joe_Griffith
Joe_Griffith

EnableVisualStyles is only available with VS 2003.  Also in some cases you may need to do this:

Application.EnableVisualStyles()
Application.DoEvents()
Avatar of Howard Cantrell
check here for free XP software - like ... menus

http://www.divil.co.uk/net/
Avatar of KBanner

ASKER

Guys,

That Application.EnableVisualStyles did seem to work in the Form Load event


Added Microsofts Vb.Net checkbox, ComboBox, Textboxes and Buttons to a form. Put Application.EnableVisualStyles()
Application.DoEvents()

in the Form_Load event

zipped it up and sent to my boss since I have Win 2000 Prof.

He sent me back as screen shot. The form appears in XP, but the controls don't!!

Am I missing something guys.

Would be very grateful for your guidance!

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi All,

Sorry for late reply. Been away on holiday (vacation)

ptakja - not all controls have the FlatStyle to change to System namely ComboBox and TextBox. obviously TextBox being the main control. Have I overlooked something??

Ian, (and also Joe Griffiths)  - Have done what you said. thanks for that.
Problem is I don't have XP to try out. Have emailed application to my boss, and he'll be able to check it out on his machine. Will let you know once he get back to me. Here's hoping!!!

Thanking all for their help, it's always appreciated!

Stuart
Just for those who are confused by the reply for StuartK and the original was for KBanner. KBanner is my bosses account that posted on his behalf.
On my XP machine, when I call Application.EnableVisualStyles(), combo boxes appear with the XP style.

On controls that have a FlatStyle property, you need to make sure that it is set to System.
That is a little easier that dealing with the manifest file, in my opinion.

Jeff
StuartK,

ComboBox and TextBox both automatically inherit system visual styles. You don't have to change anything for these to appear in XP style. This is true for most controls that don't have the FlatStyle property.

Ian
Avatar of KBanner

ASKER

Hi Ian, Jeff and Joe

Just got a reply from my boss, XP style is now on all controls. The answer is a combination of the two methods described by both of you

This is my solution

- Creating the Manifest file allows XP style to appear for those controls that do not have FlatStyle property.

- Manifest file does not work for controls that have FlatStyle property.

- The answer for FlatStyle controls is to use the solution of setting FlatStyle to System and run the code Application.EnableVisualStyles in the Form_Load event.

I know it's only points, but will increase the points to reflect your dedicated answers. If I could buy you all a pint in the virtual world I would.

Guys, seriously thank you, my boss is well over the moon, and asked me to pass on his thanks aswell.

Stuart