1.form1的button事件下: form2 form = new form2(); form.Show(); Thread.Sleep(10000); //form2窗體顯示10秒 form.Close(); //form2窗體關閉 2.form1的button事件下: form2 form ...
1.form1的button事件下:
form2 form = new form2();
form.Show();
Thread.Sleep(10000); //form2窗體顯示10秒
form.Close(); //form2窗體關閉
2.form1的button事件下:
form2 form = new form2();
form.ShowDialog(); //模式化視窗
form2窗體添加工具箱的Timer控制項
滑鼠右擊Timer屬性:
Interval:10000 //10秒後執行timer1_Tick
Enabled:True //計時器啟動
滑鼠雙擊Timer:
Private void timer1_Tick(object sender,EventArgs e)
{
this.Close();
}