XP Styles in vb.net 2003?

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

Is there a way to turn on XP Styles in 2003? Or is the manifest file still
the way to go?
 
Hi Terry,

It's pretty simple. Place this in the sub new of the start class of the
app:
MyBase.New()

Application.EnableVisualStyles()

Application.DoEvents()

Then designate all checkboxes, command buttons, radio buttons flatstyle
property to 'system'.

This will allow all pc's running xp to see all of your controls with xp
styles.

HTH,

Bernie Yaeger
 
This works also...but why does the MSDN tell you to put it in Sub Main and
then run Form1 from there?
 
Bernie,
Rather then inside the sub new, I would strongly recommend putting this in
the Sub Main of your start class as the other suggest.

Public Class MainForm
...

Public Shared Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New MainForm)
End Sub

End Class

For four major reasons:
1. Its not hidden in the construtor, which may be modified by the forms
designer.
2. It allows you to easily add any Global Exception Handlers at the same
time.
3. It allows you to customize the Application.Run itself (splash screens,
login dialog & such)
4. Its how most samples show it (consistency).

It has nothing really to do with "they are making an assumption about your
start class" per se. (as MainForm is going to be the start object in both
cases).

Hope this helps
Jay
 
Why is the "DoEvents" needed? It seems to work okay without it...or am I
missing something?
 
Terry,
Selected controls (toolbars for example) do not always display correctly if
you call EnableVisualStyles without the DoEvents (yes a bug).

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

XP Style Buttons 3
XP-style controls 2
style xp button 3
image button vb.net 2003 1
Use XP style without Manifest file? 2
AI Art Generator 12
Making Outlook 2003 Style Navigation Bar in VB.Net 2005 ? 1
WinXP Style 2

Back
Top