2016年1月8日 星期五

開啟新的Form且定時自動關閉

1.Create new Form, name Form2
2.At Form1:
private void btn_Buttin1_Click(object sender, EventArgs e)
{
    Form2 FM2 = new Form2();
    FM2.ShowDialog();
}
3.At Form2:
private void Form2_Shown(object sender, EventArgs e)
{
    this.timer1.Start();
}

private void timer1_Tick(object sender, EventArgs e)
{
    this.timer1.Interval = 1000; //1秒
    this.Close();
}