void ShowForm(DevExpress.XtraEditors.XtraUserControl uControl) { if (splitCC_quanLyHocVien.Panel2.Controls.Count > 0) { splitCC_quanLyHocVien.Panel2.Controls.RemoveAt(0); } uControl.Bounds = splitCC_quanLyHocVien.Panel2.DisplayRectangle; splitCC_quanLyHocVien.Panel2.Controls.Add(uControl); }
private void ShowPage(string Title, DevExpress.XtraEditors.XtraUserControl ucPage) { DevExpress.XtraTab.XtraTabPage xtraPage = new DevExpress.XtraTab.XtraTabPage(); xtraPage.Text = Title; xtraPage.Controls.Add(ucPage); ucPage.Dock = DockStyle.Fill; this.xtcMain.TabPages.Add(xtraPage); this.xtcMain.SelectedTabPage = xtraPage; }
/// <summary> /// 跟据module打开相应的模块 /// </summary> /// <param name="module"></param> public DevExpress.XtraEditors.XtraUserControl OpenModule(DataTable module) { if (module != null && module.Rows != null && module.Rows.Count > 0) { object userControl = CJia.HIS.App.Tools.Reflection.GetInstance( module.Rows[0]["ASSEMBLY"].ToString() , module.Rows[0]["CLASSNAME"].ToString() , new object[0]); DevExpress.XtraEditors.XtraUserControl usercon = userControl as DevExpress.XtraEditors.XtraUserControl; int newHeight = this.Size.Height < usercon.Size.Height + 120 ? usercon.Size.Height + 120 : this.Size.Height; int newWidth = this.Size.Width < usercon.Size.Width + 10 ? usercon.Size.Width + 10 : this.Size.Width; this.ParentForm.Size = new Size(newWidth, newHeight); this.Size = new Size(newWidth, newHeight); if (!this.isExistPage(module.Rows[0]["MODULE_NAME"].ToString())) { this.ShowPage(module.Rows[0]["MODULE_NAME"].ToString(), usercon); } return(usercon); } return(null); }
/// <summary> /// 加载界面 /// </summary> public BaseView LoadView(Type targetType) { try { if (currentView != null) { currentView.Visible = false; } BaseView newView = null; foreach (Control control in this.panelControlMain.Controls) { if (control.GetType() == targetType) { newView = (BaseView)control; break; } } if (newView == null) { newView = (BaseView)Activator.CreateInstance(targetType); panelControlMain.Controls.Add(newView); //newView.MDIView = this; } currentView = newView; newView.Visible = true; newView.Focus(); newView.OnLoad(); //this.lblTitle.Text = newView.Title; return(newView); } catch (Exception ex) { XtraMessageBox.Show(ex.Message); return(null); } }
/// <summary> /// 初始化默认模块 /// </summary> /// <param name="module">默认模块</param> public void initDefaultPage(DataTable module) { DevExpress.XtraEditors.XtraUserControl userCon = this.OpenModule(module); }