When creating a context menu, is there a way to have header text included? For example, when a user clicks a button, I want a context menu to show with two options. There should also be text above the options, with a sentence such as: 'Please select an option'.
Is this possible?
You can't do it with the designer but you can do it in code:
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
contextMenuStrip1.Items.Insert(0, new ToolStripLabel("Please select an option"));
contextMenuStrip1.Items.Insert(1, new ToolStripSeparator());
}
}
You can make a menu with 4 elements in this order:
- "Please select an option" -Disabled (this make it gray out and unlickable)
- Separator (------)
- Option1 -Enabled
- Option2 -Enabled