現在のウィンドウを閉じて別のウィンドウを開く
1432 ワード
namespace CloseOpen { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(NewForm)); thread.Start(); while (thread.ThreadState != System.Threading.ThreadState.Running) ; this.Close(); } private void NewForm() { Application.Run(new Form2()); } } }