Create and configure a MenuStrip

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
Exam Prep. Guides
70-505 Study Guide
70-526 Study Guide

1. Forms Controls

2. Integrating Data
3. Printing/Reporting
4. Enhancing Usability
5. Asynchronous Prog.
6. Forms Controls
7. Configure/Deploy

edit
Exam 70-526 Preparation Guide: Create and configure a MenuStrip component on a Windows Form.


Contents


The MenuStrip control was new to .NET 2.0 and replaced the MainMenu control; however, the MainMenu control has been retained for backward compatibility and future use if you so choose.


Inheritance hierarchy

System.Object 
  System.MarshalByRefObject 
    System.ComponentModel.Component 
      System.Windows.Forms.Control 
        System.Windows.Forms.ScrollableControl 
          System.Windows.Forms.ToolStrip 
            System.Windows.Forms.MenuStrip

From this hierarchy we can see the classes that the MenuStrip class inherits from a ToolStrip.


Useful properties

  • AllowItemReorder (Inherited from ToolStrip) - Gets or sets a value indicating whether drag-and-drop and item reordering are handled privately by the MenuStrip class. Set the property to true to allow reordering. At run time, the user holds down the ALT key and the left mouse button to drag a ToolStripMenuItem to a different location on the MenuStrip.
  • AllowMerge (Inherited from ToolStrip) - When enabled, this property allows multiple-document interface (MDI) children to combine their respective menus in the MDI parent.
  • Dock - Gets or sets which edge of the parent container a MenuStrip is docked to.
  • LayoutStyle - Gets or sets a value indicating how the MenuStrip lays out its items.
  • Padding (Inherited from Control) - Gets or sets the control's internal spacing characteristics. The default values for Padding are reasonably close to Windows user interface guidelines.
  • RenderMode - Gets or sets the painting styles to be applied to the MenuStrip.
  • TextDirection (Inherited from ToolStrip) - Allows the text to be rotated within the button. The property takes one of four values contained in the ToolStripTextDirection enumeration.
    • Horizontal - Specifies horizontal text orientation.
    • Inherit - Specifies that the text direction is inherited from the parent control. (Default state)
    • Vertical270 - Specifies that text is to be rotated 270 degrees clockwise.
    • Vertical90 - Specifies that text is to be rotated 90 degrees clockwise.


Exam sections


MSDN references


Today's Deals: Electronics

Personal tools