在C#中 如何让MDI的子窗体不重复

来源:百度知道 编辑:UC知道 时间:2024/05/09 05:19:38

foreach (Form froms in this.MdiChildren )
{//获取MID里的所有子窗体
if (froms is Form2)
{//判断是否有Form2
froms.Focus();//获得焦点
return;//退出过程
}
}//没有Form2就Show 一个出来
Form2 f = new Form2();
f.MdiParent = this;
f.Show();