예제 #1
0
            public void Open_Form(string fmName, string ArgStr = "", Alias al = null)
            {
                bool IsOpen = false;

                foreach (Form f in Application.OpenForms)
                {
                    if (f.Name == fmName)
                    {
                        IsOpen = true;
                        try
                        {
                            Application.OpenForms[fmName].Close();
                        }
                        catch { }
                        break;
                    }
                }
                if (IsOpen == false)
                {
                    if (fmName == "Form1")
                    {
                        Form1 fm1 = new Form1();
                        fm1.Show();
                        fm1.Focus();
                        fm1.TopMost = true;
                        fm1.textBox1.Focus();
                    }
                    if (fmName == "Form_JinCheng")
                    {
                        Form_JinCheng fm1 = new Form_JinCheng();
                        fm1.Show();
                        fm1.Focus();
                    }
                    if (fmName == "RichForm")
                    {
                        RichForm fm1 = new RichForm(ArgStr, al);
                        fm1.Show();
                        fm1.Focus();
                    }
                }
            }
예제 #2
0
파일: Main.cs 프로젝트: chusiping/fasta
        private void ShowEdit(string fmName)
        {
            bool IsOpen = false;

            //fm1.Owner = this;

            foreach (Form f in Application.OpenForms)
            {
                if (f.Name == fmName)
                {
                    IsOpen = true;
                    try
                    {
                        Application.OpenForms[fmName].Close();
                    }
                    catch { }
                    break;
                }
            }
            if (IsOpen == false)
            {
                if (fmName == "Form1")
                {
                    Form1 fm1 = new Form1();
                    fm1.Show();
                    fm1.Focus();
                    fm1.textBox1.Focus();
                }
                if (fmName == "Form_JinCheng")
                {
                    Form_JinCheng fm1 = new Form_JinCheng();
                    fm1.Show();
                    fm1.Focus();
                }
            }
        }