我想让主窗体在5秒后自动结束,咋弄阿? private void timer1_Tick(object sender, EventArgs e)
{
Form form1 = new Form();
//System.Diagnostics.Process.GetCurrentProcess().Kill();
form1.Dispose();
}
为啥没反应???我已经设置Interval=5000了为啥木有反应咧???
{
Form form1 = new Form();
//System.Diagnostics.Process.GetCurrentProcess().Kill();
form1.Dispose();
}
为啥没反应???我已经设置Interval=5000了为啥木有反应咧???
{
Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
Form form1 = new Form();
//System.Diagnostics.Process.GetCurrentProcess().Kill();
//form1.Dispose();
StartTimer();
}
DispatcherTimer timer = null;
void StartTimer()
{
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(5);
timer.Tick += new EventHandler(timer_Elapsed);
timer.Start();
} void timer_Elapsed(object sender, EventArgs e)
{
timer.Stop(); this.Close();
}这是我按你的要求修改的一段代码,理论上可以实现。