/// <summary> /// 添加左侧菜单 /// </summary> /// <param name="menuId">一级菜单的Tag 菜单id</param> /// <param name="munuName">菜单名</param> private void AddLeftMenu(string menuId, string munuName) { SYSModel.clsSysConfig.STR_CURR_MAINMEMU = menuId; if (!this.panel_LeftMenu.Controls.ContainsKey(menuId)) { UCLeftMenu UCLeftMenu = new UCLeftMenu(); //系统管理 UCLeftMenu.Name = menuId; //SYSModel.clsSysConfig.STR_CS_MEMU_FUNCTIONMANAGE; // UCLeftMenu.dtFunction = dt; UCLeftMenu.FunID = menuId; //UCLeftMenu.panel_MainHeight = pnlxLeftMenu.Height; UCLeftMenu.Dock = DockStyle.Fill; UCLeftMenu.Tag = munuName; UCLeftMenu.menuName = munuName; UCLeftMenu.FmMain = this; UCLeftMenu.Focus(); panel_LeftMenu.Controls.Add(UCLeftMenu); UCLeftMenu.BringToFront(); } else { UCLeftMenu UCLeftMenu = panel_LeftMenu.Controls.Find(menuId, false)[0] as UCLeftMenu; UCLeftMenu.LeftMenuState(SYSModel.clsSysConfig.STR_CURR_TWOMEMU, SYSModel.clsSysConfig.STR_CURR_MEMU, SYSModel.clsSysConfig.STR_CURR_MEMU); UCLeftMenu.BringToFront(); } }
private void tvUser_function_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { DataRow dr = e.Node.Tag as DataRow; HXCPcClient.UCMainLayOut.UCLeftMenu UCLeftMenu; SYSModel.clsSysConfig.STR_CURR_MAINMEMU = dr["firstid"].ToString(); //一级菜单id SYSModel.clsSysConfig.STR_CURR_TWOMEMU = dr["parent_id"].ToString(); //二级菜单id string threeMenu = e.Node.Name; //三级菜单 Control[] ctls = this.panel_LeftMenu.Controls.Find(SYSModel.clsSysConfig.STR_CURR_MAINMEMU, false); if (ctls.Length == 0) { UCLeftMenu = new HXCPcClient.UCMainLayOut.UCLeftMenu(); UCLeftMenu.Name = SYSModel.clsSysConfig.STR_CURR_MAINMEMU; UCLeftMenu.FunID = SYSModel.clsSysConfig.STR_CURR_MAINMEMU; UCLeftMenu.Dock = DockStyle.Fill; UCLeftMenu.Tag = ""; UCLeftMenu.menuName = ""; UCLeftMenu.FmMain = this; UCLeftMenu.Focus(); panel_LeftMenu.Controls.Add(UCLeftMenu); } else { UCLeftMenu = ctls[0] as HXCPcClient.UCMainLayOut.UCLeftMenu; } UCLeftMenu.LeftMenuState(SYSModel.clsSysConfig.STR_CURR_TWOMEMU, e.Node.Name); UCLeftMenu.BringToFront(); this.MenuAdd(dr); ucMenuBar1.MenuButtonStatus(); }
/// <summary> 删除标签 及其 内容 /// </summary> /// <param name="strTag">窗体的Tag 或者按钮的 Tag</param> private void deleteMenu(string strTag) { int pnlIndex = 0; string[] strArr = strTag.Split('|'); if (panelMemu.Controls.Count > 1) { var pnl = panelMemu.Controls.Find(strArr[0], true)[0] as Panel; pnlIndex = panelMemu.Controls.GetChildIndex(pnl); } panel_Content.Controls.Find(strArr[0], true)[0].Dispose(); panelMemu.Controls.Find(strArr[0], true)[0].Dispose(); if (strArr[0] == SYSModel.clsSysConfig.STR_CURR_MEMU) { if (pnlIndex > 0) { var px = panelMemu.Controls[pnlIndex - 1] as Panel; strArr = px.Tag.ToString().Split('|'); UCLeftMenu uc = panel_LeftMenu.Controls.Find(strArr[1], false)[0] as UCLeftMenu; uc.BringToFront(); childMemuState(strArr[0]); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenu.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(strArr[2], strArr[0]); SYSModel.clsSysConfig.STR_CURR_TWOMEMU = strArr[2]; } else { if (panelMemu.Controls.Count > 0) { pnlIndex = 0; var px = panelMemu.Controls[pnlIndex] as Panel; strArr = px.Tag.ToString().Split('|'); UCLeftMenu uc = panel_LeftMenu.Controls.Find(strArr[1], false)[0] as UCLeftMenu; uc.BringToFront(); childMemuState(strArr[0]); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenu.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(strArr[2], strArr[0]); SYSModel.clsSysConfig.STR_CURR_TWOMEMU = strArr[2]; } } } else { childMemuState(SYSModel.clsSysConfig.STR_CURR_MEMU);//(SYSModel.clsSysConfig.STR_CURR_MEMU); } }
/// <summary> /// 删除标签 及其 内容 /// </summary> /// <param name="strTag">窗体的Tag 或者按钮的 Tag</param> /// <param name="PUCName">父窗体name</param> private void deleteMenu(string strTag, string PUCName) { string[] strArr = strTag.Split('|'); int pnlIndex = 0; Control pnl = this.panelMemu.Controls.Find(strArr[0], false)[0] as Control; pnlIndex = this.panelMemu.Controls.GetChildIndex(pnl); pnl.Dispose(); //panel_Content.Controls.Find(strArr[0], false)[0].Dispose(); panel_Content.Controls.RemoveByKey(strArr[0]); if (PUCName.Length > 0) { Control[] ctls = this.panelMemu.Controls.Find(PUCName, false); if (ctls.Length > 0) { string name = ctls[0].Tag.ToString(); string[] Arr = name.Split('|'); if (Arr[1].Length > 0) { this.panel_Content.Controls.Find(Arr[0], false)[0].BringToFront(); ctls = this.panel_LeftMenu.Controls.Find(Arr[1], false); if (ctls.Length > 0) { UCLeftMenu uc = (UCLeftMenu)ctls[0]; uc.BringToFront(); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenuBar1.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(Arr[2], Arr[0]); } } SYSModel.clsSysConfig.STR_CURR_TWOMEMU = Arr[2]; childMemuState(Arr[0]); } } else { if (strArr[0] == SYSModel.clsSysConfig.STR_CURR_MEMU) { if (pnlIndex > 0) { pnlIndex--; } else { pnlIndex = 0; } if (panelMemu.Controls.Count > 0) { Panel px = panelMemu.Controls[pnlIndex] as Panel; strArr = px.Tag.ToString().Split('|'); if (strArr[1].Length > 0) { Control[] ctls = panel_LeftMenu.Controls.Find(strArr[1], false); if (ctls.Length > 0) { UCLeftMenu uc = ctls[0] as UCLeftMenu; uc.BringToFront(); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenuBar1.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(strArr[2], strArr[0]); } } childMemuState(strArr[0]); SYSModel.clsSysConfig.STR_CURR_TWOMEMU = strArr[2]; } } else { (panel_LeftMenu.Controls.Find(SYSModel.clsSysConfig.STR_CURR_MAINMEMU, false)[0] as UCLeftMenu) .LeftMenuState(SYSModel.clsSysConfig.STR_CURR_TWOMEMU, SYSModel.clsSysConfig.STR_CURR_MEMU); childMemuState(SYSModel.clsSysConfig.STR_CURR_MEMU); } } }
/// <summary> 删除标签 及其 内容 /// </summary> /// <param name="strTag">窗体的Tag 或者按钮的 Tag</param> /// <param name="PUCName">父窗体name</param> private void deleteMenu(string strTag, string PUCName) { int pnlIndex = 0; string[] strArr = strTag.Split('|'); if (panelMemu.Controls.Count > 1) { var pnl = panelMemu.Controls.Find(strArr[0], true)[0] as Panel; pnlIndex = panelMemu.Controls.GetChildIndex(pnl); } Control[] colArr = panel_Content.Controls.Find(strArr[0], true); if (colArr.Length > 0) { colArr[0].Dispose(); } panelMemu.Controls.Find(strArr[0], true)[0].Dispose();// panel_Main.Controls.Find(name, true)[0].Dispose(); if (PUCName != "" && panelMemu.Controls.Find(PUCName, true).Length > 0) { string name = panelMemu.Controls.Find(PUCName, true)[0].Tag.ToString(); string[] Arr = name.Split('|'); if (Arr[1] != "") { UCLeftMenu uc = (UCLeftMenu)panel_LeftMenu.Controls.Find(Arr[1], true)[0]; uc.BringToFront(); panel_Content.Controls.Find(Arr[0], true)[0].BringToFront(); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenu.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(Arr[2], Arr[0]); SYSModel.clsSysConfig.STR_CURR_TWOMEMU = Arr[2]; } childMemuState(Arr[0]); } else { if (strArr[0] == SYSModel.clsSysConfig.STR_CURR_MEMU) { if (pnlIndex > 0) { var px = panelMemu.Controls[pnlIndex - 1] as Panel; strArr = px.Tag.ToString().Split('|'); UCLeftMenu uc = panel_LeftMenu.Controls.Find(strArr[1], false)[0] as UCLeftMenu; uc.BringToFront(); childMemuState(strArr[0]); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenu.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(strArr[2], strArr[0]); SYSModel.clsSysConfig.STR_CURR_TWOMEMU = strArr[2]; } else { if (panelMemu.Controls.Count > 0) { pnlIndex = 0; var px = panelMemu.Controls[pnlIndex] as Panel; strArr = px.Tag.ToString().Split('|'); UCLeftMenu uc = panel_LeftMenu.Controls.Find(strArr[1], false)[0] as UCLeftMenu; uc.BringToFront(); childMemuState(strArr[0]); SYSModel.clsSysConfig.STR_CURR_MAINMEMU = uc.FunID; ucMenu.MenuButtonStatus();//三级菜单选中时 一级菜单的选中状态 uc.LeftMenuState(strArr[2], strArr[0]); SYSModel.clsSysConfig.STR_CURR_TWOMEMU = strArr[2]; } } } else { (panel_LeftMenu.Controls.Find(SYSModel.clsSysConfig.STR_CURR_MAINMEMU, true)[0] as UCLeftMenu).LeftMenuState(SYSModel.clsSysConfig.STR_CURR_TWOMEMU, SYSModel.clsSysConfig.STR_CURR_MEMU); childMemuState(SYSModel.clsSysConfig.STR_CURR_MEMU);//(SYSModel.clsSysConfig.STR_CURR_MEMU); } } }