当A窗体要打开B窗体时,如果B窗体时打开或者最小化状态,则不再重新打开窗体,避免窗体重复出现
那就判断窗体是否是打开状况
bool isOpne = false; //默认是关闭状态
foreach (Form frm in Application.OpenForms)
{
if (frm is HG2)
{
frm.Activate();
frm.WindowState = FormWindowState.Normal;
isOpne = true;
break;
}
}
if (!isOpne)
{
HG2 hg = new HG2();
hg.AccountID = Account_ID;
hg.Show();
}
this.Close();
————————————————
版权声明:本文为CSDN博主「gyj岛主」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_40379044/article/details/88686450
另自己研究:
foreach (Form frm in Application.OpenForms)
{
if (frm is Frm_The_Final_Bill_Cancel)
{
// frm.Activate();
Frm_The_Final_Bill_Cancel frm1 = frm as Frm_The_Final_Bill_Cancel;
frm1.GetDateData();
}
}