其他分享
首页 > 其他分享> > Winform 避免打开重复窗体

Winform 避免打开重复窗体

作者:互联网

foreach (Form f in Application.OpenForms)
   {
                if (f.Name == "Form1")
                {
                    if (f.WindowState == FormWindowState.Minimized)
                    {
                        f.WindowState = FormWindowState.Normal;
                    }
                    f.Activate();
                    f.Show();
                    return;
                }
    }

    Form1  f2 =new  Form1();
    f2.Name = " Form1";
    f2.Show();

标签:f2,Name,Show,重复,WindowState,Form1,窗体,FormWindowState,Winform
来源: https://www.cnblogs.com/wml-it/p/16370503.html