5,448,416 members and growing! (22,656 online)
Email Password   helpLost your password?
Desktop Development » Menus » General     Intermediate

Office 2003 Menus

By Mohammed Halabi

A component to change the look of the menus to that of Office 2003
C#, Windows, .NET 1.1, .NETVisual Studio, VS.NET2003, Dev

Posted: 23 Feb 2004
Updated: 23 Feb 2004
Views: 213,563
Bookmarked: 94 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
67 votes for this Article.
Popularity: 8.02 Rating: 4.39 out of 5
2 votes, 3.0%
1
3 votes, 4.5%
2
4 votes, 6.0%
3
10 votes, 14.9%
4
48 votes, 71.6%
5

Introduction

Just with one Single Line of code, you can change the look of all Menus and Context menus of your Windows Forms Project to look just like the menus shipped with Office 2003. Also, you can add Icons to your menus with a single line of code. There is one more feature in this component, You can simple call the method End to change the menus to its original look.

Using the code

To use the Component, First, add the component to the Toolbox, and then drag it to the form, and then just call this Method:

// To start showing the Office 2003 Menus

OfficeMenus1.Start( FormName );

Also, you can change the look of the menus to its original look by calling this method:

// to change the look of the menus to its original "classic" look

OfficeMenus1.End();

Adding Icons to Menu Items is very simple, Just add an ImageList to your project, and then change the ImageList property of your OfficeMenu Component to the ImageList you wish to use, and then use this code:

// Adding a picture to your Menus

// OfficeMenus.AddPicture( MenuItem MenuItemToAddPictureTo, int ImageIndex );

OfficeMenus1.ImageList = imageList1;
OfficeMenus1.AddPicture(menuItem2, 1);

Points of Interest

I was so confused about the way i will add pictures to menus, so i decided to add a collection of type NameValueCollection, and when we call the method AddPicture it will add the Handle of the menu and the Image index to that Collection, and when we want to retrieve the image of a menu, we search this collection for the handle of the menu, if found it returns the picture, otherwise it returns null. Check the code for more information. BTW, the code is well commented.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Mohammed Halabi



Location: Saudi Arabia Saudi Arabia

Other popular Menus articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 81 (Total in Forum: 81) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralUpdated Code?memberkevinlkingma6:06 17 Nov '06  
GeneralGood Control: But.....memberSameers (theAngrycodeR )16:02 22 Oct '06  
GeneralProblem With images in a menumemberIndarjeet0:49 29 Aug '06  
GeneralThe problem about the contextmenumembersleet_t23:23 12 Dec '05  
GeneralBug Report : Menu DisappearsmemberMrEyes14:51 27 Nov '05  
QuestionContext MenuesmemberGolden Dragon13:24 9 Oct '05  
AnswerRe: Context MenuesmemberJosma0:29 4 May '06  
Generali want to learn program by VC++memberthanhvu22:39 4 Oct '05  
Generalhow can a draw a line separator?memberaxelbrian7:09 8 Sep '05  
GeneralRe: how can a draw a line separator?memberThomas-H.2:34 7 Oct '05  
GeneralUsing MdiList in MenumemberJK_net23:41 3 Jul '05  
GeneralShortcut DisplaymemberDarthVeda3:32 16 Jun '05  
GeneralRe: Shortcut DisplaymemberBalder1978-23:11 4 Sep '05  
GeneralIs there any possibility to use more than one contextmenu per form?membertgrk6:37 7 Jun '05  
GeneralGreat control, but I have problem with ContextMenusmembertgrk4:45 7 Jun '05  
GeneralRe: Great control, but I have problem with ContextMenusmembertgrk5:58 7 Jun '05  
GeneralContext menu on notify iconmemberAlex Matthews1:01 31 May '05  
GeneralRe: Context menu on notify iconmemberBalder1978-23:14 4 Sep '05  
GeneralOwner Drawn dynamic content bugmemberJoeKau3:01 14 May '05  
GeneralRe: Owner Drawn dynamic content bugmemberLiosha23:43 13 Sep '05  
GeneralRe: Owner Drawn dynamic content bugmemberJoeKau0:07 14 Sep '05  
GeneralRe: Owner Drawn dynamic content bugmemberLiosha2:47 14 Sep '05  
Generalfor hotkeymemberpichamp23:07 10 Mar '05  
GeneralRe: for hotkeymemberNguyen Le19:00 23 Mar '05  
GeneralRe: for hotkeymemberThomas-H.2:04 24 Mar '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 23 Feb 2004
Editor: Nishant Sivakumar
Copyright 2004 by Mohammed Halabi
Everything else Copyright © CodeProject, 1999-2008
Web12 | Advertise on the Code Project