如何检查表单是否打开,以及是否打开以关闭表单?
我尝试了以下方法,测试了一些代码,但它一直说表单没有打开,即使我知道它是:
foreach(Form a in Application.OpenForms)
{
if (a is YouLikeHits_Settings)
{
// About form is open
MessageBox.Show("form open");
break;
}
// About form is not open...
MessageBox.Show("form not open");
break;
}