Solve your visual style issues in VS.NET

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
15,032
Location
Sydney, Australia
Programming Experience
10+
Skybound Software, at http://www.skybound.ca/developer/default.aspx have a component that fixes the visual style support in VS.NET. Just add it to a form and magically all regular controls support visual styles, including spinners and images on buttons. May I mention that I'm not affiliated with Skybound, but I've been using this free component and think everyone should.
 
I'm not so sure, I used it and everything looked the same. Buttons still square, controls still don't look the XP part.
 
bloukewer said:
I'm not so sure, I used it and everything looked the same. Buttons still square, controls still don't look the XP part.
You may have used it incorrectly. In your Main() procedure you need to call Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles(), then add a VisualStyleProvider component to each Form. You can add the component to the Toolbox to make this task as easy as adding any other control or component. Then you should find that each control on the Form that is supported by VisualStyles will have a new entry in the Misc section of the Properties window entitled something like "VisualStyleSupport on VisualStyleProvider1" that is True by default. You should also leave the FlatStyle property set to Standard for all controls that support it, like Buttons. Please try this and let me know if it still doesn't work. While there are many options for overcoming the poor visual style support in VS, I think that VisualStyles is fantastic because it allows you to keep using all the standard controls. I think every VS.NET 2002/3 deveoper should use it.
 
jmcilhinney said:
You may have used it incorrectly. In your Main() procedure you need to call Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles(), then add a VisualStyleProvider component to each Form. You can add the component to the Toolbox to make this task as easy as adding any other control or component. Then you should find that each control on the Form that is supported by VisualStyles will have a new entry in the Misc section of the Properties window entitled something like "VisualStyleSupport on VisualStyleProvider1" that is True by default. You should also leave the FlatStyle property set to Standard for all controls that support it, like Buttons. Please try this and let me know if it still doesn't work. While there are many options for overcoming the poor visual style support in VS, I think that VisualStyles is fantastic because it allows you to keep using all the standard controls. I think every VS.NET 2002/3 deveoper should use it.

I have done al you said above...
this is what happends...
my first form that loads has the XP looks, but when i push a button to open another form that other form is in the old look..ik close that subform and then the looks of the first form are also changed to the old look...
what is the problem :s

(sorry for my bad English)

thanx in advance
 
It works well now

I had forgotten wan sub main() in a form...and that form without a main i always opened as second form...

thanks!

But I have a next question :)

when I run this application on another computer..does iet gives the xp look immediately?
 
Snosky said:
It works well now

I had forgotten wan sub main() in a form...and that form without a main i always opened as second form...

thanks!

But I have a next question :)

when I run this application on another computer..does iet gives the xp look immediately?
Reading this post again, I'm not sure that you aren't a little confused. You only have a single Main method. If you are already using a module then I'd suggest declarng it in there. If not, I'd suggest declaring it as a Shared member of your main form. You can then set the startup object for the project to the form/module that contains the Main method or to the Main method itself. You would then have at least this code in your Main method:
VB.NET:
Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
Application.DoEvents()

'Add any other code required here.

Application.Run(New Form1) 'where Form1 is your main form.
 
Ok in the form that starts (called Beginscherm)
i placed the following:

VB.NET:
 Public Shared Sub main()
        Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
        Application.DoEvents()

        'Add any other code required here.

        Application.Run(New Beginscherm) 'where Form1 is your main form.
    End Sub

This works.. thanx

but now another question..when i open this project on another pc, how can I make this that the xp look is automatically integrated? (correct Englisch?)


greetz!
 
If you are opening this project in VS on another machine then you would have to install VisualStyles on that machine and make sure that the reference was valid. VS will place a warning icon on any invalid references in a project, so you can simply remove it and add a valid one. If VisualStyles is installed to the same location on both machines then probably wouldn't even have to do that. Note that VisualStyles is redundant in VS 2005 as it supports visual styles properly without help.
 
Back
Top