EnableVisualStyles in 2003?

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hello,

I'm using Visual Studio 2003 and it would be nice if my buttons and other
controls could look like Windows XP buttons rather than the flat square
kind. I looked on the web and found some info on
Application.EnableVisualStyles, but I'm not seeing much indication that 2003
supports it. Does it? And if so, how does it work?
 
Peter said:
I'm using Visual Studio 2003 and it would be nice if my buttons and other
controls could look like Windows XP buttons rather than the flat square
kind. I looked on the web and found some info on
Application.EnableVisualStyles, but I'm not seeing much indication that 2003
supports it. Does it? And if so, how does it work?

I'm not sure if this is supported in VS 2003. In VS 2005 (including
the Express versions) you'd open the menu Project > YourProjectName
Properties and would check "Enable Xp visual styles" in the
Application tab.

As a last resource, you could go the manifest route (sigh):

<link>
http://www.vbaccelerator.com/home/V...yles/Using_XP_Visual_Styles_in_VB/article.asp
</link>

(beware of word wrap)

HTH.

Regards,

Branco.
 
Peter said:
I'm using Visual Studio 2003 and it would be nice if my buttons and other
controls could look like Windows XP buttons rather than the flat square
kind. I looked on the web and found some info on
Application.EnableVisualStyles, but I'm not seeing much indication that
2003 supports it. Does it? And if so, how does it work?

Yes, it's supported. Adapt your 'Sub Main' to look similar to this one:

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

Note that Windows XP visual styles must be enabled in Windows in order to
see the difference.
 
Herfried K. Wagner said:
Yes, it's supported. Adapt your 'Sub Main' to look similar to this one:

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

....and controls with a FlatStyle property must be set to FlatStyle.System.

For Buttons this means no Image, but you'll find sourcecode for a
replacement Button on my site:
http://www.dotnetrix.co.uk/buttons.html
 
Herfried K. Wagner said:
Yes, it's supported. Adapt your 'Sub Main' to look similar to this one:

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

Thanks for the tip... although that does not work for me. It says
'EnableVisualStyles is not a member of System.Windows.Forms.Application.'
 
Peter said:
Thanks for the tip... although that does not work for me. It says
'EnableVisualStyles is not a member of
System.Windows.Forms.Application.'

You're sure you're using VS2003 and not VS2002? According to the help
(q.v.), System.Windows.Forms.Application.EnableVisualStyles was introduced
with .NET 1.1.

Andrew
 
Andrew Morton said:
You're sure you're using VS2003 and not VS2002? According to the help
(q.v.), System.Windows.Forms.Application.EnableVisualStyles was introduced
with .NET 1.1.

Well, by cracky, I thought I was using 2003. Guess it IS 2002. Don't I feel
the perfect fool.
 
Peter said:
Well, by cracky, I thought I was using 2003. Guess it IS 2002. Don't
I feel the perfect fool.

You've been working too hard... backup your computer and then have a few
days off :-)

Andrew
 
Back
Top