Click here to Skip to main content
14,868,945 members
Articles / Programming Languages / C#
Posted 15 Oct 2007


322 bookmarked

WindowsVistaRenderer: A New Button Generation

Rate me:
Please Sign up or sign in to vote.
4.86/5 (140 votes)
23 Nov 2007CPOL3 min read
ToolStripRenderer that renders Vista like buttons
Screenshot - VistaRenderer.jpg


This article demonstrates how to use the WindowsVistaRenderer and how it was created.


Don't you miss the days when a button was drawn with a couple of lines to show a 3D effect? Drawing a button was as simple as drawing the light border and the shadow border. Those days are gone. Vista has arrived and our old apps may need to be renewed.

The first time you look at a button like the ones on Vista look and feel, you must feel dizzy. How to draw buttons like that? Well it turns out that it is not such a great deal. It took me a while to totally understand how these buttons are drawn, but I think the result is a good approach.

Using the Code

Thank God for the ToolStripRenderer technology.

To use this renderer on a ToolStrip you only need one line of code:

// Apply Windows Vista look and feel

toolStrip1.Renderer = new Renderers.WindowsVistaRenderer();

The Renderer initializes the necessary properties for the ToolStrip, except for the LayoutStyle property which I recommend to be the default HorizontalStackWithOverflow, otherwise the toolbar may look ugly in some cases.

The source solution contains a project named Renderers. Reference that DLL to your project or copy the source files to your project.

How to Draw a Button Like That

As I said before, the old-school buttons were drawn in a very easy way:

Screenshot - VistaRenderer1.gif Screenshot - VistaRenderer2.gif

The whole idea is to make the user think that he or she is really pushing a button, when clicked shadows were inverted, text pushed one pixel on x and one pixel on y, and the click effect was done.

The Vista buttons are way more complex. I've found different layers on the button drawing.


Three rounded rectangles are drown as a border, I call them the outer border, the border and the inner border.

Screenshot - VistaRenderer3.gif

Glossy Effect

A glossy effect is drawn on the north of the button. The green color represents an almost transparent color.

Screenshot - VistaRenderer4.gif


A radial gradient simulates a color glow on the south of the button. The green color represents an almost tansparent color.

Screenshot - VistaRenderer5.gif

Button Fill

Similar to the glossy effect, the inner border area is emphasized with a linear button fill from north to south.

Putting It All Together

Now, the order in which we draw these layers is critical. That order is:

  1. Outer border
  2. Button background color (if button is checked)
  3. Glossy effect
  4. Border
  5. Button fill glossy emphasis
  6. Inner border
  7. Glow
  8. Text and image of the button
Screenshot - VistaRenderer6.jpg

Some Other Details

To create the click effect, the color of the inner border and the button fill are changed. When clicked, the text is not pushed one pixel like in the old days.

When checked, the background color of the button changes. That color was extracted from the tabs on the MediaPlayer.

To make the toolbar a full-Vista-experience component, menus are drawn using the Windows Vista look and feel.


Thanks to Lukasz Swiatkowski for the methods on creating rounded rectangles and the bottom radial path.


  • 15 Oct 2007: Article creation
  • 25 Oct 2007: Subitem initialization by recursion solved (suggested by rvpilot)
  • 21 Nov 2007: Combobox and Textbox support. Better overflow chevron.
  • 23 Nov 2007: MenuStrip support.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Product Manager
United States United States
Jose Menendez

- I've been programming Windows and Web apps since 1997.
- My greatest concern nowadays is product, user interface, and usability.

Personal site

Comments and Discussions

Question[My vote of 2] Problem! Pin
User 1327559321-Sep-17 5:24
MemberUser 1327559321-Sep-17 5:24 
QuestionTabControl Pin
jyrka984-Nov-14 18:38
Memberjyrka984-Nov-14 18:38 
QuestionGreat Work - take 5! Pin
Jens Madsen, Højby20-Jul-14 7:34
MemberJens Madsen, Højby20-Jul-14 7:34 
QuestionHow to Change background colors Pin
Singh Vijay Kumar2-Apr-13 2:15
professionalSingh Vijay Kumar2-Apr-13 2:15 
GeneralMy vote of 2 Pin
programmerdon17-Oct-12 8:15
Memberprogrammerdon17-Oct-12 8:15 
QuestionBinaries Pin
Vercas21-Jun-11 2:55
MemberVercas21-Jun-11 2:55 
AnswerRe: Binaries Pin
JoseMenendez21-Jun-11 3:05
MemberJoseMenendez21-Jun-11 3:05 
GeneralRe: Binaries Pin
Vercas21-Jun-11 3:21
MemberVercas21-Jun-11 3:21 
QuestionIs there a renderer with Windows 7 theme? Pin
stax7614-Aug-09 0:48
Memberstax7614-Aug-09 0:48 
Generalnot properly recover default renderer Pin
Huisheng Chen17-Jan-09 15:36
MemberHuisheng Chen17-Jan-09 15:36 
Generalmenu not properly rendered in windows 2003 Pin
Huisheng Chen17-Jan-09 14:43
MemberHuisheng Chen17-Jan-09 14:43 
Questionrenderer in Pin
JoeFisher716-Nov-08 5:35
MemberJoeFisher716-Nov-08 5:35 
AnswerRe: renderer in Pin
JoseMenendez6-Nov-08 6:36
MemberJoseMenendez6-Nov-08 6:36 
GeneralAbout new button generation Pin
marclenoir20051-Sep-08 6:27
Membermarclenoir20051-Sep-08 6:27 
GeneralRe: About new button generation Pin
JoseMenendez1-Sep-08 6:55
MemberJoseMenendez1-Sep-08 6:55 
QuestionLegal for commerical Application? Pin
o m n i31-May-08 8:58
Membero m n i31-May-08 8:58 
QuestionThe control looks very good. Is there any way to implement the same look and feel in web pages of Pin
shanmukha627424-Feb-08 17:34
Membershanmukha627424-Feb-08 17:34 
AnswerRe: The control looks very good. Is there any way to implement the same look and feel in web pages of Pin
The Cake of Deceit26-Jun-08 11:36
MemberThe Cake of Deceit26-Jun-08 11:36 
QuestionLicence Pin
Julian-w30-Dec-07 23:26
MemberJulian-w30-Dec-07 23:26 
GeneralFighting the tools Pin
Mount30-Dec-07 22:57
MemberMount30-Dec-07 22:57 
QuestionHow do I do this with just the command buttons? Pin
JonathanVQP19-Dec-07 6:55
professionalJonathanVQP19-Dec-07 6:55 
AnswerRe: How do I do this with just the command buttons? Pin
The Cake of Deceit27-Jun-08 5:10
MemberThe Cake of Deceit27-Jun-08 5:10 
GeneralTranslation to [modified] Pin
virtual.aussie26-Nov-07 10:13
Membervirtual.aussie26-Nov-07 10:13 
Generaljust move to WPF Pin
dimzon21-Nov-07 6:48
Memberdimzon21-Nov-07 6:48 
AnswerRe: just move to WPF Pin
mofle21-Nov-07 11:43
Membermofle21-Nov-07 11:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.