Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
  • *Experts*
Posted

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.

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.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • Leaders
Posted

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]

 

Also, you'll need to set your controls to System for the XP style.[/Quote]

This is done by setting the FlatStyle property to System.

 

There is also a sample manifest in MSDN.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted
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.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

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.

Posted
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
Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...