我正在使用 DispatcherTimer 在 C# 中调用 void:
counter = new System.Windows.Threading.DispatcherTimer();
counter.Tick += new EventHandler(counter_Tick);
counter.Interval = new TimeSpan(0, 0, 1);
counter.Start();
但是我希望间隔是几毫秒,TimeSpan 的参数是小时、分钟、秒,并且只接受整数(据我所知)。 DispatcherTimer 有解决方法吗?我试过 Timer 但我不能使用它(显然缺少引用)
提前致谢。
最佳答案
另一种方式
counter.Interval = TimeSpan.FromMilliseconds(1);
关于c# - DispatcherTimer 的毫秒间隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30581756/