//判断是否有打开 public static Form ExistedForm(Type type) { return Application.OpenForms.Cast<Form>().FirstOrDefault(form => form.GetType() == type); } var isExist = CommonOperation.ExistedForm(typeof(Frm2)); if (isExist == null) { Frm2.show(); } else { isExist.WindowState = FormWindowState.Normal; isExist.Activate(); }
Form2 fm2 = new Form2(); if (fm2.Visible == false) { fm2 = new Form2(); } else { fm2.WindowState = FormWindowState.Normal; }
110,567
社区成员
642,567
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧