C#调用子窗体后关闭自身(父窗体)
实现思想:新建一个线程用来显示Form2,Form1的消息循环线程就可以结束了。 private void Button1_MouseClick(object sender, MouseEventArgs e) { Thread t = new Thread(new ThreadStart(delegate { Application.Run(new Form2()); })); t.Start(); this.Dispose(true); }
实现思想:新建一个线程用来显示Form2,Form1的消息循环线程就可以结束了。 private void Button1_MouseClick(object sender, MouseEventArgs e) { Thread t = new Thread(new ThreadStart(delegate { Application.Run(new Form2()); })); t.Start(); this.Dispose(true); }