消除MDIChildren的可能重复
本文关键字:MDIChildren 消除 | 更新日期: 2023-09-27 18:35:25
我的代码有什么问题,用于防止MDI儿童重复???
//Create a new instance of the MDI child template form
FAnalysis fanalysis = null;
if (fanalysis != null)
{
fanalysis.WindowState = FormWindowState.Normal;
fanalysis.Focus();
}
else
{
fanalysis = new FAnalysis();
fanalysis.MdiParent = this;
//Display the child window
fanalysis.Show();
changeVisible(false, false, true, true, true, true);
}
任何帮助都会被理解...谢谢
我会做这样的事情:
foreach(Form child in this.MdiChildren)
{
if (child is FAnalysis)
{
if (child.WindowState == FormWindowState.Minimized)
{
child.WindowState = FormWindowState.Normal;
}
child.BringToFront();
return; // stop looking and exit the method
}
}
// no match was found; create a new child:
FAnalysis fanalysis = new FAnalysis();
fanalysis.MdiParent = this;
fanalysis.Show();
changeVisible(false, false, true, true, true, true);