Tooltip in Windows Forms ContextMenuStrip (ContextMenuStripEx)

15 Nov 20231 minute to read

Tooltip is nothing but a hint, showing short format or customized text about the menu item, when mouse hover on it. It can be enabled using the ShowItemToolTips property. The ToolTipText property is used to set the short format or customized text for each menu item.

The below code snippet will explain how to set tooltip for context menu items.

this.contextMenuStripEx.ShowItemToolTips = true;
this.toolStripMenuItem1.ToolTipText = "Used to create a new file";
this.toolStripTextBox1.ToolTipText = "Used to provide a editable text";
this.toolStripComboBox1.ToolTipText = "Used to provide a collection of items";
Me.contextMenuStripEx.ShowItemToolTips = True
Me.toolStripMenuItem1.ToolTipText = "Used to create a new file"
Me.toolStripTextBox1.ToolTipText = "Used to provide a editable text"
Me.toolStripComboBox1.ToolTipText = "Used to provide a collection of items"

Tooltip

Auto Tooltip

The AutoTooltip property is set to false by default. In such case, the control will display the text set in the ToolTipText property of the menu item as discussed above. But on setting it to true, it will display the exact text set in the Text property of each menu item if and only if ToolTipText property remains empty.

The below code snippet will explain how to set auto tooltip for menu items.

this.toolStripMenuItem1.AutoToolTip = true;
this.toolStripTextBox1.AutoToolTip = true;
this.toolStripComboBox1.AutoToolTip = true;
Me.toolStripMenuItem1.AutoToolTip = True
Me.toolStripTextBox1.AutoToolTip = True
Me.toolStripComboBox1.AutoToolTip = True

Auto Tooltip