Click here to Skip to main content
12,399,799 members (53,010 online)
Click here to Skip to main content
Add your own
alternative version

Stats

303.7K views
1.5K downloads
99 bookmarked
Posted

Magic MenuControl - VS.NET Style

, 29 Sep 2002
Rate this:
Please Sign up or sign in to vote.
Menus that mimic VS.NET/OfficeXP
<!-- Download Links --> <!-- Article image -->

Sample Image - MagicMenuControl.gif

Why another MenuControl?

The .NET Framework contains a wide range of user interface controls, but they offer only a basic look and feel. Today's user expects a richer experience that you just cannot build with the out-of-the-box controls. The Magic Library (of which this MenuControl is a major part) aims to solve this by providing a set of user interface elements that add the sophistication expected from modern Windows applications.

Downloads

The first download MenuControl Sample contains a example application that uses shows the MenuControl from the Magic Library. This allows you to experiment and test out the feature. The actual source code is inside the separate second download. At nearly 1MB in size, I thought people would prefer to download the sample before deciding if they want to install the entire source code project!

Description

The usual way to create a menu for your application is via the Menu property of your applications main Form. Unfortunately this gives a very basic look and feel and does not support the new Visual Studio .NET appearance.

This is where the MenuControl class comes into its own as it closely mimics the Visual Studio .NET look and feel. Not only that, but you can create as many instances as you like and place them anywhere on your Form. You can even use the Dock property to place the control against the left/right and bottom edges as well as the traditional top position. When placed on the left or right edges it will draw the menu items vertically.

When using the control within an MDI application it is important that exactly one instance of the MenuControl uses the MdiContainer property. This property should be given a reference to the MDI parent Form so that it can correctly display the pendant for MDI child Forms .

MenuCommand Instances

The control exposes a property called MenuCommands that contains the collection of MenuCommand instances for display. You cannot use the builtin menu designer to generate the instances and so will need to use code to create the structure you need. Look at the sample code to see how this is done.

PopupMenu

Also demonstrated in the sample is use of the PopupMenu class that can be seen by right clicking the RichTextBox present inside each MDI child instance. This shows how to create a context menu using the VS.NET/OfficeXP look and feel. It uses the same MenuCommand instances as the MenuControl.

More Details

Download and install the Magic Libary where a couple of more detailed artiles describe how all the various features of the MenuControl and PopupMenu work.

Revision History

30 Sept 2002 - Initial Revision

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

Share

About the Author

Phil Wright
Web Developer
United Kingdom United Kingdom
I am a big fan of .NET and have been working on developing a free user interface library to enhance the very basic controls that come out-of-the-box. Download the free source code project from http://www.dotnetmagic.com. I often carry out bespoke development work for companies, so feel free to email me for a quote on your .NET needs!



You may also be interested in...

Comments and Discussions

 
Questionlicx Pin
HemantPune16-Sep-07 19:32
memberHemantPune16-Sep-07 19:32 
GeneralNow it is no more for free Pin
Anonymous7-Jun-05 5:57
sussAnonymous7-Jun-05 5:57 
GeneralRe: Now it is no more for free Pin
Gazon7-Jun-05 7:54
memberGazon7-Jun-05 7:54 
GeneralDon't add the MDI child Menu Pin
cscrazy14-May-05 2:49
membercscrazy14-May-05 2:49 
GeneralRelate with NotifyIcon Pin
Gazon12-Feb-05 16:30
memberGazon12-Feb-05 16:30 
QuestionProgrammatically forcing an update? Pin
Rick Pingry21-Dec-04 9:24
memberRick Pingry21-Dec-04 9:24 
QuestionNot CLS Compliant? Pin
Rick Pingry8-Sep-04 13:45
memberRick Pingry8-Sep-04 13:45 
AnswerRe: Not CLS Compliant? Pin
DelphiCoder12-Oct-04 19:49
memberDelphiCoder12-Oct-04 19:49 
GeneralRe: Not CLS Compliant? Pin
Rick Pingry13-Oct-04 4:08
memberRick Pingry13-Oct-04 4:08 
GeneralRe: Not CLS Compliant? Pin
DelphiCoder20-Oct-04 9:43
memberDelphiCoder20-Oct-04 9:43 
GeneralRe: Not CLS Compliant? Pin
Rick Pingry20-Oct-04 10:11
memberRick Pingry20-Oct-04 10:11 
GeneralNedd GUI controls Pin
send2tusharp@yahoo.com29-Aug-04 20:11
membersend2tusharp@yahoo.com29-Aug-04 20:11 
GeneralProblems with dynamic contextmenu + notifyIcon Pin
gein29-May-04 0:31
membergein29-May-04 0:31 
GeneralProgrammatically opening a menu Pin
Rick Pingry25-May-04 6:35
memberRick Pingry25-May-04 6:35 
QuestionHow I Install DotNetBar in my Visual Studio .NET Pin
sk0rpi0n16-Mar-04 4:44
membersk0rpi0n16-Mar-04 4:44 
GeneralError with menu within menu Pin
KlaasjanMors14-Feb-04 11:17
memberKlaasjanMors14-Feb-04 11:17 
GeneralMerge MDI Child Menu with MDI Parent Menu. Pin
SunilNRao11-Jan-04 18:58
memberSunilNRao11-Jan-04 18:58 
GeneralAdding &quot;Popup Menu&quot; as Context Menu to a ToolBar Pin
jayakarthikeyan23-Dec-03 3:10
memberjayakarthikeyan23-Dec-03 3:10 
GeneralCompiling on command line Pin
Marc Heiligers5-Nov-03 7:04
memberMarc Heiligers5-Nov-03 7:04 
GeneralBUG: Showing a PopupMenu over controls that handle MouseEnter/MouseLeave Pin
dacris27-Aug-03 9:17
memberdacris27-Aug-03 9:17 
GeneralRe: BUG: Showing a PopupMenu over controls that handle MouseEnter/MouseLeave Pin
Anonymous4-Oct-04 9:05
sussAnonymous4-Oct-04 9:05 
GeneralTo Phil Pin
namortaror@hotmail.com20-Aug-03 5:50
membernamortaror@hotmail.com20-Aug-03 5:50 
GeneralUrgent! Pin
psusong18-Jun-03 1:17
memberpsusong18-Jun-03 1:17 
QuestionSos!!How can i add my own icon to the menu?? Pin
Anonymous8-Apr-03 1:24
sussAnonymous8-Apr-03 1:24 
AnswerRe: Sos!!How can i add my own icon to the menu?? Pin
Manster7-Jul-03 3:19
memberManster7-Jul-03 3:19 
GeneralRe: Sos!!How can i add my own icon to the menu?? Pin
pcangle30-Jul-03 20:34
memberpcangle30-Jul-03 20:34 
GeneralRe: Sos!!How can i add my own icon to the menu?? Pin
pcangle30-Jul-03 20:36
memberpcangle30-Jul-03 20:36 
GeneralRe: Sos!!How can i add my own icon to the menu?? Pin
Rick Pingry25-May-04 6:31
memberRick Pingry25-May-04 6:31 
GeneralRe: Sos!!How can i add my own icon to the menu?? Pin
Anonymous14-Apr-05 1:39
sussAnonymous14-Apr-05 1:39 
GeneralRe: Sos!!How can i add my own icon to the menu?? Pin
Anonymous26-May-05 20:49
sussAnonymous26-May-05 20:49 
GeneralRe: Sos!!How can i add my own icon to the menu?? Pin
Rick Pingry27-May-05 2:38
memberRick Pingry27-May-05 2:38 
GeneralGreat free codes! Pin
hustcaozy6-Apr-03 17:54
memberhustcaozy6-Apr-03 17:54 
QuestionHow to merge child menu with the MDI parent's? Pin
Udupa28-Mar-03 1:53
memberUdupa28-Mar-03 1:53 
GeneralBad Code Pin
TemplMetaProg28-Mar-03 1:34
memberTemplMetaProg28-Mar-03 1:34 
GeneralRe: Bad Code Pin
Anonymous6-Apr-03 15:43
sussAnonymous6-Apr-03 15:43 
QuestionCan not set MDIList for the MenuCommand in a MDI Form. Pin
frontad23-Mar-03 22:01
memberfrontad23-Mar-03 22:01 
AnswerRe: Can not set MDIList for the MenuCommand in a MDI Form. Pin
Richard A. Johnn2-May-03 10:56
memberRichard A. Johnn2-May-03 10:56 
GeneralMagic 1.7.3 Released Pin
Phil Wright2-Mar-03 10:16
memberPhil Wright2-Mar-03 10:16 
GeneralAdding Menu command Pin
David XZ24-Feb-03 19:57
memberDavid XZ24-Feb-03 19:57 
GeneralRe: Adding Menu command Pin
rlujo28-Mar-03 4:24
memberrlujo28-Mar-03 4:24 
GeneralNotifyIcon + ContextMenu Icon Error Pin
rund1me18-Feb-03 3:38
memberrund1me18-Feb-03 3:38 
GeneralRe: NotifyIcon + ContextMenu Icon Error Pin
Robert J9-Apr-03 23:19
memberRobert J9-Apr-03 23:19 
GeneralBackground color of IDE menu Pin
TravisSmith3-Feb-03 22:30
memberTravisSmith3-Feb-03 22:30 
GeneralRe: Background color of IDE menu Pin
Anonymous8-Feb-03 19:42
sussAnonymous8-Feb-03 19:42 
QuestionWhat Happened to www.dotnetmagic.com Pin
Joel Matthias30-Jan-03 13:54
memberJoel Matthias30-Jan-03 13:54 
GeneralMigration issues Pin
SebekZ20-Jan-03 20:50
sussSebekZ20-Jan-03 20:50 
GeneralContext Menu for System Tray Pin
Pooran Prasad R.20-Jan-03 19:15
memberPooran Prasad R.20-Jan-03 19:15 
Questioncan it be control for a container, for example a panel Pin
xhw6-Jan-03 23:55
memberxhw6-Jan-03 23:55 
Generalgray popup menu background color Pin
Bao Nguyen23-Nov-02 11:44
memberBao Nguyen23-Nov-02 11:44 
Generaltg5t Pin
Anonymous15-Nov-02 6:11
sussAnonymous15-Nov-02 6:11 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160721.1 | Last Updated 30 Sep 2002
Article Copyright 2002 by Phil Wright
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid