private void TestMoreWindows_Load(object sender, EventArgs e) { TestForm1 t1 = new TestForm1(); t1.MdiParent = this; t1.Show(); TestForm1 t2 = new TestForm1(); t2.MdiParent = this; t2.Show(); }
//切换到窗口1 private void button1_Click(object sender, EventArgs e) { Form fo = FindMdiChildren("TestForm1"); if (fo != null) { fo.Show(); } else { fo = new TestForm1(); fo.MdiParent = this; fo.Show(); } fo.Activate(); }