我需要動態禁用菜單項的子子項。這裏在菜單欄中如果我運行啓動時,禁用啓動選項應該禁用如何實現這一點。我已附上快照參考如何禁用菜單條子菜單
// Run At Startup
private void runAtStartupToolStripMenuItem_Click(object sender, EventArgs e)
{
rkApp.SetValue("TimeCalculation", "\"" + Application.ExecutablePath.ToString() + "\"");
Environment.GetFolderPath(Environment.SpecialFolder.Startup);
menuStrip1.Items["disableStartupToolStripMenuItem"].Enabled = false;
}
//Disable Startup
private void disableStartupToolStripMenuItem_Click(object sender, EventArgs e)
{
rkApp.DeleteValue("TimeCalculation", false);
menuStrip1.Items["runAtStartupToolStripMenuItem"].Enabled = false;
}
快照:
什麼'Environment.GetFolderPath'呢?你不使用它的返回值。 – joe