Question

I would like to be able to display an image and a check mark next to a menu item in a mainMenu. Currently, it's either an image or a check mark, but I'm afraid both at the same time are not possible.

Image

If I add menuItemOption1.Checked = true;, the item is checked but the image is not displayed anymore:

Check mark

I didn't find any other way to show the user that some menu item is checked (can't change the text color), can someone think of any way?

(I would like to keep the images displayed as my menu items have not-that-obvious names, and the images are a great way for the user to understand the menus.)

Était-ce utile?

La solution

I solved this by changing simply the menu texts:

menuItemOption1.Text = "[✓] Option 1";

Autres conseils

You can't do it from the designer, but try adding this to your code:

public Form1() {
  InitializeComponent();

  ((ToolStripDropDownMenu)optionsMenu.DropDown).ShowCheckMargin = true;
  ((ToolStripDropDownMenu)optionsMenu.DropDown).ShowImageMargin = true;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top