Beispiel #1
0
 /// <summary>
 /// 关闭当前窗口
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void menuCloseCurrentWindow_Click(object sender, EventArgs e)
 {
     try
     {
         subForm = (FrmBase)this.ActiveMdiChild;
         subForm.Close();
     }
     catch (Exception ex)
     {
         Logger.Error("关闭当前窗口 ERROR。", ex);
     }
 }
Beispiel #2
0
 /// <summary>
 /// openWinForm
 /// </summary>
 private void OpenWinForm(string aNamespace, string aName, string aTitle, string tag)
 {
     try
     {
         string   strFormName = "CZZD.ERP." + aNamespace + "." + aName;
         Assembly a           = this.LoadAssembly(aNamespace);
         Type     frmType     = a.GetType(strFormName);
         if (frmType == null)
         {
             return;
         }
         foreach (Form frmChild in this.MdiChildren)
         {
             if (frmChild.GetType() == frmType && (tag.Equals(frmChild.Tag) || frmChild.Tag == null))
             {
                 frmChild.WindowState = FormWindowState.Maximized;
                 frmChild.Activate();
                 return;
             }
         }
         object  obj = Activator.CreateInstance(frmType, true);
         FrmBase frm = (FrmBase)obj;
         frm.CTag        = tag;
         frm.MinimizeBox = false;
         frm.UserTable   = this._userInfo;
         frm.MdiParent   = this;
         frm.WindowState = FormWindowState.Maximized;
         frm.Text        = aTitle;
         frm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
         Logger.Error("打开新窗口异常!", ex);
     }
 }