C# from 只打开一次,且打开时获取焦点

bool bl = false;
            foreach (Form f in Application.OpenForms)
            {
     
                if (f.Name == "ClassList")
                {
     
                    bl = true;
                    f.Activate();
                    break;
                }
            }
            if (!bl)
            {
     
                ClassList classList = new ClassList();
                classList.MdiParent = this;
                classList.Show();
            }

你可能感兴趣的:(C#,c#)