/// <summary> /// 隐藏左侧工具栏 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lblPlaceholder7_Click(object sender, EventArgs e) { if (lblPlaceholder7.Text == "<") { lblPlaceholder7.Text = ">"; tbn_show.Text = "显示"; tbn_show.Tag = "显示左侧菜单"; lblPlaceholder7.Tag = "显示左侧菜单"; MainToolBar.Width = 0; lblPlaceholder6.Width = 0; } else { lblPlaceholder7.Text = "<"; tbn_show.Text = "隐藏"; tbn_show.Tag = "隐藏左侧菜单"; lblPlaceholder7.Tag = "隐藏左侧菜单"; MainToolBar.Width = 170; lblPlaceholder6.Width = 8; } if (CurrentForm != null) { currentForm.WindowState = System.Windows.Forms.FormWindowState.Maximized; if (!CurrentForm.IsDisposed) { CurrentForm.Show(); } } }
private void openWatchMain() { try { string key = "设备调度"; string formText = " " + key; formName = Dictionary[key].ToString(); if (!ShowChildrenForm(formText)) { //以下是通过反射 获得该窗体的实例 Type t = Type.GetType(Global.namespceName + "." + formName); CurrentForm = (Form)Activator.CreateInstance(t); CurrentForm.MdiParent = this; //设置窗体的标题 CurrentForm.Text = formText; if (!CurrentForm.IsDisposed) { CurrentForm.WindowState = FormWindowState.Maximized; CurrentForm.Show(); } } } catch (Exception) { } }
public virtual void MoveToPrevious() { CurrentForm.Hide(); CurrentFormIndex--; CurrentForm.Show(); }
/// <summary> /// 处理工具栏中相关项的点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void PanelEvent(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (sender is Label) { try { string key = ((Label)sender).Text; //获得数据字典中的key 即功能项目的名称 string formText = " " + key; formName = Dictionary[key].ToString(); //获得数据字典中的 对应窗口的类名 if (!ShowChildrenForm(formText)) { //以下是通过反射 获得该窗体的实例 Type t = Type.GetType(Global.namespceName + "." + formName); CurrentForm = (Form)Activator.CreateInstance(t); CurrentForm.MdiParent = this; //设置窗体的标题 CurrentForm.Text = formText; if (!CurrentForm.IsDisposed) { CurrentForm.WindowState = FormWindowState.Maximized; CurrentForm.Show(); } } } catch (Exception ex) { MessageBox.Show("该功能出现错误:" + ex.Message); } } else { PanelIcon pic = (PanelIcon)sender; List <Outlook_Table_Jb_User> list = (List <Outlook_Table_Jb_User>)table[pic.iconPanel]; Outlook_Table_Jb_User jb_user = list[pic.Index]; try { string key = jb_user.Itemname; //获得数据字典中的key 即功能项目的名称 string formText = " " + key; formName = Dictionary[key].ToString(); //获得数据字典中的 对应窗口的类名 if (!ShowChildrenForm(formText)) { //以下是通过反射 获得该窗体的实例 Type t = Type.GetType(Global.namespceName + "." + formName); CurrentForm = (Form)Activator.CreateInstance(t); CurrentForm.MdiParent = this; //设置窗体的标题 CurrentForm.Text = " " + key; if (!CurrentForm.IsDisposed) { CurrentForm.WindowState = FormWindowState.Maximized; CurrentForm.Show(); } } } catch (Exception ex) { MessageBox.Show("该功能出现错误:" + ex.Message); } } } }