look and feel modification? i forget.

sde

Centurion
Joined
Aug 28, 2003
Messages
160
Location
us.ca.fullerton
it's been a while since i coded a windows form project. i vaugely remember a parameter in before the application loaded that enhanced the form to look more modern. any ideas?
 
If you looking for an XP look with VS2003 then in the main forms New sub located in the "Windows Form Designer generated code" region add the following.
Visual Basic:
Application.EnableVisualStyles
Application.DoEvents

If you're using VS2002 then you'll need to wirte a manifest file. You'll get lots of examples from a Google search.

I haven't used 2005 yet, but I understand that it automatically sets VisualStyles without any of the possible bugs that VS2002 and 2003 shared using the XP look.

Also, you'll need to set your controls to System for the XP style.
 
To elaborate on DiverDan's post:

It is recommended that EnableVisualStyles be called before your main form's constructor, to ensure that absolutely no controls are created before the call to EnableVisualStyles (otherwise, some controls may be bounds to the wrong version of Common Controls and display incorrectly).
[Vb]
'In your main form's code
Public Shared Sub Main()
Application.EnableVisualStyles()
Application.DoEvents()
Application.Run(New Form1) 'Replace with your form's name
End Sub
[/CODE]

DiverDan said:
Also, you'll need to set your controls to System for the XP style.
This is done by setting the FlatStyle property to System.

There is also a sample manifest in MSDN.
 
If you are using 2003 you might consider the manifest file over EnableVisualStyles as there are a few bugs with the EnableVisualStyles depending on your program that will cause your program to crash.
 
Zing! To cover the topic once again..

I highly recommend the Skybound control mentioned in this post (and the post this post links to all on the same subject.) The manifest still has visual style bugs/problems with regards to rendering properly. You can find a link to that in the post above as well.
 
I have a simple question about Skybound. When using the skybound controls, does it only work using XP or does it work with 2000 as well? at work we are using W2K0
 
Unfortunately, the style will depend on the machine you are running the application on. That goes for any technique you use, manifest file, skybound control, and so on. I'm pretty sure you'll have to look into skinning if you want XP themes on Win2000.
 
Back
Top