///判断窗体是否已存在实例 /// /// /// 窗体类型 ///public static Form ExistedForm(Type type) { return Application.OpenForms.Cast
使用方法:
Form isExist = ExistedForm(typeof(Form1)); if (isExist == null) { Form1 Frm = new Form1(); Frm.Show(); } else { isExist.WindowState = FormWindowState.Normal; isExist.Activate(); }