1.首先需要定義新的窗體:
private Form anotherForm; //聲明新窗體
2.在需要跳轉的動作下面寫上跳轉事件:
private void Button1_Click(object sender, EventArgs e)//實現隱藏舊窗體,跳轉新窗體
{
anotherForm = new Form2(); //定義新窗體
this.Hide(); //隱藏舊窗體
anotherForm.ShowDialog(); //展示新窗體
Application.ExitThread(); //退出當前線程上的消息循環,並關閉該線程上的所有窗口。
}
3。至此就實現了點擊Button1切換到不同界面!
