当我启动计时器时..timel 正常递增..但是一旦我停止计时器,即调用 click_TimerStop 函数并再次启动计时器...... timel 变量增加 timel+=2..当我重复过程..它增加了timel + = 3 ..它继续下去......我该如何纠正这个?..
DispatcherTimer clktimer = new DispatcherTimer();
private void click_TimerStart(object sender, RoutedEventArgs e)
{
clktimer.Start();
clktimer.Interval =new TimeSpan(0,0,1);
clktimer.Tick +=clktimer_tick;
}
private int timel = 0;
private void clktimer_tick(object sender, object e)
{
timel++;
timerSecond.Text = timel.ToString();
}
private void click_TimerStop(object sender, RoutedEventArgs e)
{
clktimer.Stop();
}