实现效果:
知识运用:
ToolStripMenuItem属性的Visiable属性
实现代码:
private void 展开关闭其他项ToolStripMenuItem_Click(object sender, EventArgs e) { switch(G_bl){ case true: this.员工录入ToolStripMenuItem.Visible = true; this.添加用户ToolStripMenuItem.Visible = true; this.设置密码ToolStripMenuItem.Visible = true; this.忘记密码ToolStripMenuItem.Visible = true; this.修改密码ToolStripMenuItem.Visible = true; G_bl = false; this.操作ToolStripMenuItem.ShowDropDown(); break; case false: this.员工录入ToolStripMenuItem.Visible = false; this.添加用户ToolStripMenuItem.Visible = false; this.设置密码ToolStripMenuItem.Visible = false; this.忘记密码ToolStripMenuItem.Visible = false; this.修改密码ToolStripMenuItem.Visible = false; G_bl = true; this.操作ToolStripMenuItem.ShowDropDown(); break; } }