bool isopen=false;
foreach (Form childrenForm in this.MdiChildren)
{
if (childrenForm.Name=="fatherName")//这里对你来说应该是form2
{
childrenForm.Visible = true;//如果你要求关闭的话就只要close就可以了,我现在是如果存在就显示,你可以参考一下,你也可以不
childrenForm.Activate();
isopen = true;
return;

}
}
if (!isopen)
{
FrmsetProduct productSet = new FrmsetProduct();
productSet.MdiParent = this;
productSet.WindowState = FormWindowState.Maximized;
productSet.Show();
}

}

第二种方法 :Application.OpenForms["Form2"].Dispose();

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-12-05
  • 2021-12-29
  • 2021-07-17
  • 2021-10-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
相关资源
相似解决方案