C# FAQ: Why doesnt a Windows Form project use visual styles in XP
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| CSharp-Online.NET:FAQs |
| edit |
[edit]
Why doesn't a Windows Form project use visual styles in XP?
Even if Application.EnableVisualStyles was called, sometimes a Windows Form project seems to ignore visual styles in Windows XP.
If a property on a Windows Forms control is set which forces the creation of the control—e.g. the SelectedIndex property on the ComboBox class—, then the control—and maybe even the rest of the form—will not be rendered as expected with visual styles enabled.
The solution is to move the code which sets these properties to the Load event handler of the control or form.