C#winform判断窗体是否已打开

传入窗体名称,如果窗体运行状态返回true,否则为false.

private bool CheckActivate(String activateName)
        {
            bool b = false;
            foreach (Form f in Application.OpenForms)
            {
                if (f.Name == activateName)
                {
                    b = true;
                    f.Activate();
                    break;
                }
            }
            return b;

        }

你可能感兴趣的:(笔记)