(cms.Items[6] as ToolStripMenuItem).DropDownItems.Add("Close program",null, new EventHandler(CloseProgram_Click));
(cms.Items[6] as ToolStripMenuItem).DropDownItems.Add("Show message", null, new EventHandler(ShowMessage_Click));
(cms.Items[6] as ToolStripMenuItem).DropDownItems.Add("-");
(cms.Items[6] as ToolStripMenuItem).DropDownItems.Add("Do nothing", null, new EventHandler(DoNothing_Click));
private void CloseProgram_Click(object sender, EventArgs e)
{
// I want mark this menuItem on dropdownItem
}
当我选择 menuItem 时,我希望它被选中。
像这样。