DispatcherTimer类位于System.Windows.Threading命名空间下,类似于winform的Timer类。
      
       {
        DispatcherTimer  timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += new EventHandler(timer_Tick);
        
        }
        void timer_Tick(object sender, EventArgs e)
        {
            tb.Text = DateTime.Now.ToLongTimeString();
        }
上面的代码演示了一个简单的时钟程序,每隔一秒中更新一次时间

ClockTest.rar下载

如何在wpf中使用Thread:http://blog.csdn.net/artlife/archive/2007/01/08/1477366.aspx

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-08-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-09-09
相关资源
相似解决方案