我有一个名为ToolStripMenuItem
的{{1}}。现在,当用户点击它时,我希望它为mailResultsToolStripMenuItem
,当用户再次点击它时,我希望.Selected = true
。.Selected = false
我试过了:
mailResultsToolStripMenuItem.Selected = true;
但它显示错误,该属性只读。
答案 0 :(得分:1)
你在寻找ToolStripMenuItem.Checked
吗?
// true if the ToolStripMenuItem is checked or is in an indeterminate state;
// otherwise, false. The default is false.
mailResultsToolStripMenuItem.Checked = true;
// Also interesting: mailResultsToolStripMenuItem.CheckState
// mailResultsToolStripMenuItem.CheckOnClick