You can interate over the OpenForms collection to check if there is already a form of the given type:
foreach (Form form in Application.OpenForms)
{
if (form.GetType() == typeof(MyFormType))
{
form.Activate();
return;
}
}
Form newForm = new MyFormType();
newForm.MdiParent = this;
newForm.Show();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…