asp.net c# Winfrom窗体自动打开与关闭

作者:袖梨 2022-06-25

asp教程.net c#  winfrom窗体自动打开与关闭

  if (this.checkchildfrmexist("addfrom") == true)
 {
  return;
 }
 addfrom form2 = new addfrom();
 form2.mdiparent = this;
 form2.show();

  private bool checkchildfrmexist(string childfrmname)
 {
  foreach(form childfrm in this.mdichildren)
  {
   if(childfrm.name == childfrmname)
   {
    if(childfrm.windowstate == formwindowstate.minimized)
     childfrm.windowstate = formwindowstate.normal;
     childfrm.activate();
    return true;
   }
  }
  return false;
 }

//"关闭的时候用addfrom.close()关闭"

//方法二

if (from1 == null || from1.isdisposed)
{
 from1 = new from1();
}
else
{
 from1.activate();
}

相关文章

精彩推荐