如何打开用户控件并关闭2秒

时间:2010-12-06 23:10:56

标签: c# winforms

Hello People如何打开userControl并在2秒后关闭并显示另一个表单? c#WinForms

1 个答案:

答案 0 :(得分:6)

public void MyFunction()
{
    firstForm.ShowDialog();
    secondForm.Show();
}

public void firstForm_Load(object sender, EventArgs e)
{
    Timer timer = new System.Windows.Forms.Timer() { Interval = 2000 };
    timer.Tick += delegate { timer.Stop(); Close(); };
    timer.Start();
}