Windows Develop Bookmark and Share   
 index > Windows Forms General > apply WinXp visual style to winforms
 

apply WinXp visual style to winforms

hi all.

i'v tried the code from the msdn site,regarding "How to add Visual Styles (the Windows XP look and feel) to your C# ",
but when i build my project i get an error msg saing: "could not find the "Microsoft.Windows.Common-Controls, Version=6.0.0.0,Culture=*,
PublicKeyToken=6595b64144ccf1df,processorArchitecture="X86",Type=win32"
**i'm using WinXp and VS 2005.
shimshon  Tuesday, December 05, 2006 1:58 PM

Remove any manifest file you might have added and add the following code at the very start of your application before you ever interact with WinForms:

Application.EnableaVisualStyles();
Application.SetCompatibleTextRendering(true); //Not technically needed but generally used

Michael Taylor - 12/5/06

TaylorMichaelL  Tuesday, December 05, 2006 2:17 PM

i already had the code you wrote in my program.cs file under [stathread]

and i'm still getting the error msg, saing "could not find..."

shimshon  Wednesday, December 06, 2006 5:38 AM
That implies that you haven't actually removed the manifest file.
It's the manifest file you added that's trying to reference the thing that can't be found.

Is it still lurking around somewhere? You need to remove it.

Matthew Watson  Wednesday, December 06, 2006 9:54 AM
WILL THE VISUAL STYLE AFFECTtextBoxes ALSO?
shimshon  Wednesday, December 06, 2006 2:21 PM

It will affect anything that XP impacts. Also be aware that the controls must use FlatStyle.System for FlatStyle otherwise the OS settings are ignored.

Michael Taylor - 12/6/06

TaylorMichaelL  Wednesday, December 06, 2006 2:52 PM

You can use google to search for other answers

Custom Search

More Threads

• tab control itemsize property (setting in code)
• Reorder tabpages
• TextBox Number Validation
• Multiline tooltip for ListView control
• Form.CausesValidation?
• Versioning question
• Satellite assembly generated using AL.exe won't work
• How to make a main menu to show a form in a main mdi form??
• C# combobox multicolumn dropdown - select return one column value
• Progress through questions in math test