Create and configure a MenuStrip
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| 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.
[edit]
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.
[edit]
Useful properties
-
AllowItemReorder(Inherited fromToolStrip) - Gets or sets a value indicating whether drag-and-drop and item reordering are handled privately by theMenuStripclass. Set the property totrueto allow reordering. At run time, the user holds down the ALT key and the left mouse button to drag aToolStripMenuItemto a different location on theMenuStrip.
-
AllowMerge(Inherited fromToolStrip) - 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 aMenuStripis docked to.
-
LayoutStyle- Gets or sets a value indicating how theMenuStriplays out its items.
-
Padding(Inherited fromControl) - Gets or sets the control's internal spacing characteristics. The default values forPaddingare reasonably close to Windows user interface guidelines.
-
RenderMode- Gets or sets the painting styles to be applied to theMenuStrip.
-
TextDirection(Inherited fromToolStrip) - Allows the text to be rotated within the button. The property takes one of four values contained in theToolStripTextDirectionenumeration.-
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.
-
[edit]
Exam sections
[edit]