Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 10th, 2004, 04:31 AM
Authorized User
 
Join Date: Feb 2004
Location: Sofia, , Bulgaria.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Windows XP controls

Hello,

i am trying to create a windows form, using windows XP looking-like controls, like buttons displaying a yellow frame when the mouse goes over them. I am using Windows XP and Visual Studio 7. I create a C# Windows Application project and add Windows Forms controls. I can't find properties configuration making the controls look like Windows XP ones(like AutoCAD 2004 controls for instance). I'm not sure if it is up to props.

If someone can give me advise how to achieve my goal i'll be verry thankful.

Alexander Panov



  #2 (permalink)  
Old April 10th, 2004, 05:54 AM
Authorized User
 
Join Date: Jun 2003
Location: Norfolk, , United Kingdom.
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Alexander

The standard windows controls in .net do not allow for this type of styling. I would suggest a third party control, infragistics do some great controls and are competitively priced, saves a lot of time writing them yourself.





Duncan
  #3 (permalink)  
Old April 10th, 2004, 01:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You would have to create the images yourself in a graphics program like Freehand/Fireworks or Photoshop, but once that is done you can use the "BackGroundImage" property of the button to set the image you want in MouseEnter and MouseLeave events of the button.

J
  #4 (permalink)  
Old April 10th, 2004, 02:18 PM
Authorized User
 
Join Date: Feb 2004
Location: Sofia, , Bulgaria.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

thanks for your answers. I suspected these ways of doing it - using another control library or create the images yourself. What puzzles me though, is that some applications or web pages, when running on Windows XP look one way and another when running on windows 2000 for example. It looks to me like these applications inherit the controls styles from the OS. But the form i create doesn't do that.

Thanks a lot once more.

Alex

  #5 (permalink)  
Old April 10th, 2004, 06:00 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alex,

You'll need to enable visual styles before your application can use them. Check out the following two MSDN articles for more info:

http://msdn.microsoft.com/library/de...x/cookbook.asp

http://msdn.microsoft.com/library/de...ndowsForms.asp

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The Beautiful Ones by Prince and the Revolution (Track 3 from the album: Purple Rain)

  #6 (permalink)  
Old April 11th, 2004, 03:39 AM
Authorized User
 
Join Date: Feb 2004
Location: Sofia, , Bulgaria.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll read the articles Imar. Thank you very much.

Alex

  #7 (permalink)  
Old April 11th, 2004, 03:02 PM
Authorized User
 
Join Date: Feb 2004
Location: Sofia, , Bulgaria.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The articles are exactly what i needed. I done the job. Thanks a lot Imar.

  #8 (permalink)  
Old April 12th, 2004, 05:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

Note that Version 1.1 of the .NET framework added a new method to the Application object called 'EnableVisualStyles'. You place a call to this method in your Sub Main; it can be used as an alternative to using a manifest as the articles require.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
  #9 (permalink)  
Old April 12th, 2004, 11:31 AM
Authorized User
 
Join Date: Feb 2004
Location: Sofia, , Bulgaria.
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well,

it also works, and I find this way of enabling visual styles more appropriate for my case. Thanks a lot Jeff.

Alex



Similar Threads
Thread Thread Starter Forum Replies Last Post
Controls and button style Windows Xp TAVOSOFT Pro VB.NET 2002/2003 1 July 21st, 2004 08:28 AM
Windows XP btls Wrox Book Feedback 1 July 13th, 2004 02:41 PM
Controls and button style Windows XP TAVOSOFT VB.NET 1 June 12th, 2004 09:59 AM
Controls and Button style Windows Xp TAVOSOFT VB.NET 2002/2003 Basics 1 June 12th, 2004 08:53 AM
Windows 98 OCX control issues vs Windows XP benoyraj VB How-To 0 May 5th, 2004 08:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.