Skip to main content
Email Password   helpLost your password?

Sample Image

Introduction

With the release of Office 2007, you will want to update your applications with the latest look and feel. With .NET 2.0, this is a simple process as you just need to use this custom renderer for the ToolStrip manager. Assign the custom renderer to the ToolStripManager.Renderer property, and it will customize the appearance of all ToolStrip, MenuStrip, StatusStrip, and ContextMenuStrip instances in your application.

Using the Custom Renderer

To make use of the custom renderer, you need to hook into the Load event of your Form. Just double click the form at design time to have the event handler for the Load event auto generated. Then, you need to add just this single line of code...

private void Form1_Load(object sender, EventArgs e)
{
   ToolStripManager.Renderer = new Office2007Renderer();
}

There are a couple of other steps you might need to take at design time. If you are using a StatusStrip, then you need to update the render mode because, by default, it will not use the global one specified in the line of code above. So for each StatusStrip, you just need to click the smart tag and set the RenderMode to be ManagerRenderMode. Likewise for any ToolStripContainer that is created, just left click in the center of the container area, and then look in the Properties window for the RenderMode and again change it to ManagerRenderMode.

Points of Interest

I would have made the context menu have rounded corners just like Office 2007, but this is not possible because of the way the tool strips have been implemented. The background of the context menu is always drawn in a color that takes up the entire client area of the popup window. So it was not possible to simulate a rounded corner by not drawing the corner pixels. I could not find a way to set a region for the popup window either. Maybe someone else will have better luck.

History

This custom renderer was created as part of the development process of adding the Office 2007 appearance to the Krypton Toolkit. The Krypton Toolkit is a free set of controls for .NET 2.0 Windows Forms applications. It implements the full Office 2007 appearance for all of its controls including buttons, panels, headers, and so forth. You can download the free toolkit from here.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralDisabled image contextMenu issue Pin
borchanii
2:42 14 Jul '09  
QuestionLicensing inquiry Pin
2twotango
3:04 10 Feb '09  
GeneralText Color Pin
Member 1940598
5:25 3 Oct '08  
GeneralVb2008 version of Office2007Renderer... no MenuItembackground Pin
dherrmann
0:26 12 Jun '08  
GeneralRe: Vb2008 version of Office2007Renderer... no MenuItembackground Pin
AngleV
1:30 22 Jun '08  
GeneralRe: Vb2008 version of Office2007Renderer... no MenuItembackground Pin
AngleV
3:28 22 Jun '08  
GeneralSmall bug... Pin
pimb2
3:28 7 May '08  
GeneralAnother bug? Pin
lextm
19:43 17 Feb '08  
GeneralTo prevent background flicker... Pin
JeremyHill
16:43 3 Jan '08  
GeneralGreat Component Pin
Chuck Catron
9:49 20 Sep '07  
GeneralYou can check out our Krypton Toolkit free library at .... Pin
caddzooks
2:32 21 Aug '07  
GeneralRe: You can check out our Krypton Toolkit free library at .... Pin
AbsCode
8:00 21 Aug '07  
GeneralRe: You can check out our Krypton Toolkit free library at .... Pin
ComponentPhil
16:28 21 Aug '07  
QuestionHow about licence? Pin
osvaldas_briedis
4:07 6 Aug '07  
GeneralRe: How about licence? Pin
lextm
3:21 22 Feb '08  
QuestionRender tab Pin
thachvv18
6:38 24 Jul '07  
AnswerRe: Render tab Pin
jpmsoft
16:10 14 Jul '08  
Questionslow draw Pin
thachvv18
9:20 17 Jul '07  
Questionhow to renderer progressbar on status strip Pin
afaz
4:03 5 Jun '07  
AnswerRe: how to renderer progressbar on status strip Pin
KoaQiu
22:53 5 Jun '07  
GeneralUsing Office 2007 ToolStrip Rendere in CodePlex projects Pin
marco.minerva
23:40 23 May '07  
GeneralRe: Using Office 2007 ToolStrip Rendere in CodePlex projects Pin
lextm
18:52 17 Feb '08  
GeneralBug in drop down checkmark rendering Pin
Scott Dorman
7:19 17 Apr '07  
GeneralKrypton Toolkit Pin
Amr Aly Elsehemy
7:03 11 Apr '07  
GeneralThanks Pin
Nigel Shaw
1:53 28 Feb '07  


Last Updated 6 Dec 2006 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009