C#:WPF 定时器的用法

参考网址:https://www.cnblogs.com/mr-yoatl/p/7131784.html

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)
{
    //定时执行的内容
}

 

你可能感兴趣的:(web开发,c#)