[]
Each menu item has settings that control whether users can see it, whether they can select it, and what text describes it. Use these settings to match the menu to the state of your app. For example, you can disable an item that isn’t available yet, hide an item that doesn’t apply to the current user, or add a tooltip that explains an icon.
The Enabled and Visible properties control whether users can select an item and whether the menu displays it.
When Enabled is false, the item stays visible, but users can’t select it. The menu draws the item in the Disabled style.
When Visible is false, the menu doesn’t display the item.
Use ToolTipText to describe what an item does. Tooltips are especially useful in IconsOnly mode, which doesn’t display item text. To turn off tooltips for the whole menu, set ShowToolTips to false.
A menu usually works together with a content area. When users select an item, the app shows the content that belongs to that item. The menu raises the ItemSelected event, and your code replaces what the content area displays.
Place a content panel next to the menu. Dock the menu and a Splitter to the left side of the form, and dock the content panel with Fill. The Splitter lets users resize the menu area.
When the selected item changes, replace the control in the panel with the control that belongs to the item.
The following example defines the methods that clear the panel and show a message. Call them from your ItemSelected handler.
void ClearContent()
{
contentPanel.Controls.Clear();
scheduleControl.Parent = null;
propertyGrid1.Parent = null;
notification.Parent = null;
}
void ShowInbox()
{
if (notification.Parent is null) ClearContent();
notification.Text = "You have no incoming emails.";
contentPanel.Controls.Add(notification);
}