How to: Hide ToolStripMenuItems Using the Designer

Hiding menu items is a way to control the user interface (UI) of your application and restrict user commands. Often, you will want to hide an entire menu when all of the menu items on it are unavailable. This presents fewer distractions for the user. Furthermore, you might want to both hide and disable the menu or menu item, as hiding alone does not prevent the user from accessing a menu command by using a shortcut key. For more information on disabling menu items, see How to: Disable ToolStripMenuItems Using the Designer.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To hide a top-level menu and its submenu items

  • Select the top-level menu item and set its Visible or Available property to false.

    When you hide the top-level menu item, all menu items within that menu are also hidden. If you click somewhere other than on the MenuStrip after setting Visible to false, the entire top-level menu item and its submenu items disappear from your form, thus showing you the run-time effect of your action. To display the hidden top-level menu item at design time, click on the MenuStrip in the Component Tray, in Document Outline, or at the top of the property grid.

Note

You will rarely hide an entire menu except for multiple document interface (MDI) child menus in a merging scenario.

To hide a submenu item

  • Select the submenu item and set its Visible property to false.

    When you hide a submenu item, it remains visible on your form at design time so that you can easily select it for further work. It will actually be hidden at run time.

See Also

Tasks

How to: Disable ToolStripMenuItems Using the Designer

Reference

Visible

MenuStrip

MenuStrip Control Overview (Windows Forms)

Enabled

Available

Overflow