Solved

XP Style

Posted on 2004-08-18
12
258 Views
Last Modified: 2010-04-23
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??
0
Comment
Question by:KBanner
  • 3
  • 2
  • 2
  • +3
12 Comments
 
LVL 7

Assisted Solution

by:Joe_Griffith
Joe_Griffith earned 100 total points
ID: 11832176
0
 
LVL 14

Expert Comment

by:ptakja
ID: 11832211
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.
0
 
LVL 7

Expert Comment

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

Application.EnableVisualStyles()
Application.DoEvents()
0
 
LVL 27

Expert Comment

by:planocz
ID: 11834837
check here for free XP software - like ... menus

http://www.divil.co.uk/net/
0
 

Author Comment

by:KBanner
ID: 11845436
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!

0
 
LVL 14

Assisted Solution

by:ptakja
ptakja earned 100 total points
ID: 11845575
The FlatStyle property for the controls all need to be set to SYSTEM.  Not standard.  Try that.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Accepted Solution

by:
ianmarsden earned 100 total points
ID: 11860683
Do what Joe Griffith said.

Open up Notepad or some plain-text editor. Copy & pate the following:
====

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="x86" name="APPLICATION_NAME" type="win32" />
<dependency>
   <dependentAssembly>
     <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />
   </dependentAssembly>
</dependency>
</assembly>

====
Remember to change the APPLICATION_NAME on the third line to your app's name as it is in VS.
Save the file as "MyApp.exe.manifest" -- the first part, MyApp, must be changed to match exactly the filename of your actual .exe
Also, make sure you save it in the same place as MyApp.exe (or whatever it's called), usually the bin folder.

Ian
0
 

Expert Comment

by:StuartK
ID: 11901544
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
0
 

Expert Comment

by:StuartK
ID: 11901610
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.
0
 
LVL 14

Expert Comment

by:ptakja
ID: 11901636
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
0
 

Expert Comment

by:ianmarsden
ID: 11906882
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
0
 

Author Comment

by:KBanner
ID: 11951317
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Showdialog 8 29
Populating an array of locale_time_info 8 37
SQL syntax in VB.net 5 30
C# Single Form 8 28
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now