C#WINFORM如何控制一段代码在3秒后关闭
展开全部
Timer timer1;
int count = 0;
public Form2()
{
InitializeComponent();
timer1 = new Timer();
timer1.Interval = 1000;
timer1.Tick += timer1_Tick;
}
private void timer1_Tick(object sender, EventArgs e)
{
Sound.Play();
count++;
if (count == 3)
timer1.Stop();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询