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(); } } }
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(); } } }