/// <summary> /// 初始化BaseForm子窗体 /// </summary> private void InitBaseForm() { try { bForm = new BaseForm(modelName); bForm.MdiParent = this; bForm.WindowState = FormWindowState.Maximized; bForm.Show(); bForm.Update(); } catch (Exception ex) { if (bForm != null) bForm.Close(); MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
/// <summary> /// 初始化BaseForm子窗体 /// </summary> private void InitBaseForm() { try { bForm = new BaseForm(modelName); bForm.MdiParent = this; bForm.WindowState = FormWindowState.Maximized; bForm.Show(); bForm.Update(); } catch (Exception ex) { if (bForm != null) { bForm.Close(); } MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
public void OpenForm(string modelname, object locate /*打开后定位到某个结点的依据,通常是一个id.*/) { foreach (Form frm in this.MdiChildren) { if (frm is BaseForm && ((BaseForm)frm).ModelName == modelname) { frm.Activate(); return; } } BaseForm doc = null; try { doc = new BaseForm(modelname); doc.MdiParent = this; doc.WindowState = FormWindowState.Maximized; doc.Show(); doc.Update(); } catch (Exception ex) { if (doc != null) { doc.Close(); } MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } m_CurBaseForm = doc; if (locate != null) { // 定位的代码. } }
public void OpenForm(string modelname, object locate/*打开后定位到某个结点的依据,通常是一个id.*/) { foreach (Form frm in this.MdiChildren) { if (frm is BaseForm && ((BaseForm)frm).ModelName == modelname) { frm.Activate(); return; } } BaseForm doc = null; try { doc = new BaseForm(modelname); doc.MdiParent = this; doc.WindowState = FormWindowState.Maximized; doc.Show(); doc.Update(); } catch (Exception ex) { if (doc != null) doc.Close(); MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } m_CurBaseForm = doc; if (locate != null) { // 定位的代码. } }