70-526 MCTS


Create and configure a MenuStrip component on a Windows Form.

The MenuStrip control is new to .NET 2.0 and replaces the MainMenu control; however, the MainMenu control is retained for backward compatibility and future use if you 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 MenuStrip 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.
    1. Horizontal - Specifies horizontal text orientation.
    2. Inherit - Specifies that the text direction is inherited from the parent control. (Default state)
    3. Vertical270 - Specifies that text is to be rotated 270 degrees clockwise.
    4. Vertical90 - Specifies that text is to be rotated 90 degrees clockwise.

    Exam sections

  • Create a MenuStrip component on a Windows Form

  • Configure a MenuStrip component on a Windows Form


    MSDN references

  • MenuStrip Class
  • MenuStrip Control (Windows Forms)


    << Previous Contents Next >>

    © Publicjoe, 2007