/*查询菜单*/ private void 查询ToolStripMenuItem_Click(object sender, EventArgs e) { /*布尔型全局变量,用来判断用户权限*/ Global Access = new Global(); /*同理为了避免重复打开子窗口*/ foreach (Form childrenForm in this.MdiChildren) { if (childrenForm.Name == (Global.access == true?"QueryForm": "NoQueryForm")) { childrenForm.Activate(); return; } } /*具有高级权限,则打开查询窗口*/ if (Global.access == true) { QueryForm frm = new QueryForm(); frm.MdiParent = this; frm.Show(); frm.Dock = DockStyle.Fill; } /*不具有高级权限,则打开拒绝查询窗口*/ else { NoQueryForm frm = new NoQueryForm(); frm.MdiParent = this; frm.Show(); frm.Dock = DockStyle.Fill; } }
private void checkAvaliabToolStripMenuItem_Click(object sender, EventArgs e) { QueryForm queryForm = new QueryForm(); queryForm.Show(); }