XP Theme... AGAIN! [UNRESOLVED]
ok...
I know this has been asked like 2,000 times... but I was wondering why XP themes don't work on my App...
I have used skybound and integrated visual style objects but it doesn't work in my project...
VB Code:
Public Sub New()
MyBase.New()
'Application.EnableVisualStyles()
'Application.DoEvents()
Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
InitializeComponent()
End Sub
I was wondering... How can I apply the visual styles on a single form, or on all forms I got...
Do I need to apply the
'Application.EnableVisualStyles()
'Application.DoEvents()
header before ALL the forms? (tried, doesn't work), on the single startup form (tried, still doesn't work)...
anyways, it's 4:00 am here, I'm gonna rest it and look it up again tomorrow!
Re: XP Theme... AGAIN! [UNRESOLVED]
You need to make the call before any form is initialized or shown. Usually as the first lines of code work best.
For the skybound issue I would suggest a DoEvents maybe? If you apply the VS to a form it will apply to all forms in your app.
Re: XP Theme... AGAIN! [UNRESOLVED]
As Rob says, enabling visual styles has to be the first thing you do, so you should call either EnableVisualStyles method as the first line in a Main method. You would normally then call Application.DoEvents immediately after. Note that the call to DoEvents is only required if you use an ImageList somewhere in your app, but it's a good idea to include it by default regardless.
Re: XP Theme... AGAIN! [UNRESOLVED]
I have not tested Skybound, but normally when you enable visual styles you have to set the FlatStyle property of the controls to 'System' otherwise they will keep their old-skool look.
Have you done this? (assuming it's necessary with skybound)
Re: XP Theme... AGAIN! [UNRESOLVED]
ya I did get my controls with flatstyle=system... I'll just add this app.doevents thing... wait up
:wave:
Re: XP Theme... AGAIN! [UNRESOLVED]
nop, not workin'...
:confused:
Re: XP Theme... AGAIN! [UNRESOLVED]
If you are using Skybound VisualStyles then you are specifically NOT supposed to set the FlatStyle to System. You call the Skybound version of EnableVisualStyles, but it must be in your Main method. You then add a VisualStyleProvider object to each form that needs to make use of one. Everything else is taken care of for you. Mind you, I suggest specifically disabling the VisualStyleProvider support for those controls for which it will make no difference to speed up rendering. This would include Buttons with no image, for which you WOULD just use the FlatStyle property.
VB Code:
Public sub Main()
Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
Application.DoEvents()
Application.Run(New Form1)
End Sub