if(this._IsExistChildForm("ChildForm"))
{
return;
}
ChildForm childForm= new ChildForm();
childForm.MdiParent = this;
childForm.Name = "ChildForm";
childForm.Show();
/// <summary>
/// 判断是否含有该子窗体
/// </summary>
/// <param name="_ChildFormName">子窗体名称</param>
/// <returns>bool</returns>
private bool _IsExistChildForm(string _ChildFormName)
{
foreach(Form form in this.MdiChildren)
{
if(string.Compare(form.Name, _ChildFormName, true) == 0)
{
form.BringToFront();
return true;
}
}
return false;
}