WPF Timer 控件在哪里? [英] Where is the WPF Timer control?

查看:22
本文介绍了WPF Timer 控件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以找到类似于 WPF 中的 C# Timer Control 的控件?

Where can I find a control which is like the C# Timer Control in WPF?

推荐答案

通常的 WPF 计时器是 DispatcherTimer,它不是控件,而是在代码中使用.它的工作方式基本上与 WinForms 计时器相同:

The usual WPF timer is the DispatcherTimer, which is not a control but used in code. It basically works the same way like the WinForms timer:

System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += dispatcherTimer_Tick;
dispatcherTimer.Interval = new TimeSpan(0,0,1);
dispatcherTimer.Start();


private void dispatcherTimer_Tick(object sender, EventArgs e)
{
  // code goes here
}

可以找到有关 DispatcherTimer 的更多信息 这里

More on the DispatcherTimer can be found here

这篇关于WPF Timer 控件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆