首页 > 代码库 > WPF 中定时器的使用

WPF 中定时器的使用

DispatcherTimer timer;

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    timer = new DispatcherTimer();
    timer.Interval = TimeSpan.FromMilliseconds(64);
    timer.Tick += timer1_Tick;
    timer.Start();
}

private void timer1_Tick(object sender, EventArgs e)
{
    //定时执行的内容
}

只是记录一下写过的代码,后面忘记的时候可以来看看,就不多做描述了!!!

WPF 中定时器的使用