我正在尝试关闭一个winform“Splash Screen”并运行另一种形式。
private void timer1_Tick(object sender, EventArgs e)
{
rectangleShape2.Width += 5;
if (rectangleShape2.Width >= 473)
{
timer1.Stop();
HomeScreen H = new HomeScreen();
H.ShowDialog();
//to close current form
this.Close();
}
}
问题是:Splash Screen表单仍在任务栏中工作
如何关闭它并将其隐藏在任务栏中?
感谢。
答案 0 :(得分:0)
希望此解决方案能够帮助您
void tmr_Tick(object sender, EventArgs e)
{
//after 3 sec stop the timer
tmr.Stop();
//display mainform
Mainform mf = new Mainform();
mf.Show();
//hide this form
this.Hide();
}
Double-click on the FormClosed Event and add this Code:
private void Mainform_FormClosed(object sender, FormClosedEventArgs e)
{
//exit application when form is closed
Application.Exit();
}
答案 1 :(得分:0)
尝试替换
this.Hide()
来自
this.Close()
为我工作