public void CreateMDIControl(string strTitle, string strTag, XtraUserControl ctrl, Image image) { try { DevExpress.XtraTabbedMdi.XtraMdiTabPage currentPage = null; if (currentPage == null) { loading.ShowWaitForm(); MdiForm frm = new MdiForm(); frm.Visible = false; ctrl.Dock = DockStyle.Fill; frm.FormClosing += new FormClosingEventHandler(frm_FormClosing); frm.Text = strTitle; frm.Tag = strTag; ctrl.Tag = strTag; ctrl.Text = strTitle; if (!IsTabbedMdi) { frm.ClientSize = new Size(this.Width, this.Height); } frm.Controls.Add(ctrl); frm.MdiParent = this; if (image != null) { frm.ShowIcon = true; } else { image = base.Icon.ToBitmap(); } frm.Show(); currentPage = xtraTabbedMdiMgr.SelectedPage; } else { xtraTabbedMdiMgr.SelectedPage = currentPage; } if (currentPage != null && ctrl is ucIndex) { currentPage.ShowCloseButton = DefaultBoolean.False; } } catch (Exception ex) { loading.CloseWaitForm(); XtraMessageBox.Show(ex.Message); } finally { loading.CloseWaitForm(); LayoutMdi(); GC.Collect(); } }
public void CreateMDIControl(string strTitle, string strTag, XtraForm frmBase, Image image) { try { DevExpress.XtraTabbedMdi.XtraMdiTabPage currentPage = null; if (currentPage == null) { loading.ShowWaitForm(); frmBase.Dock = DockStyle.Fill; frmBase.FormClosing += new FormClosingEventHandler(frm_FormClosing); frmBase.Text = strTitle; frmBase.Tag = strTag; if (!IsTabbedMdi) { frmBase.ClientSize = new Size(this.Width, this.Height); } frmBase.MdiParent = this; if (image != null) { frmBase.ShowIcon = true; } else { image = base.Icon.ToBitmap(); } frmBase.Show(); currentPage = xtraTabbedMdiMgr.SelectedPage; xtraTabbedMdiMgr.SelectedPage.Image = image; } else { xtraTabbedMdiMgr.SelectedPage = currentPage; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } finally { loading.CloseWaitForm(); LayoutMdi(); } }