DispatcherTimer.Start 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
启动 。DispatcherTimer
public:
void Start();
public void Start();
member this.Start : unit -> unit
Public Sub Start ()
示例
以下示例创建一个 DispatcherTimer. 将创建一DispatcherTimer个名为的新dispatcherTimer对象。 事件处理程序 dispatcherTimer_Tick 将添加到事件 Tick 中。 使用IntervalTimeSpan对象将设置为 1 秒。
// DispatcherTimer setup
dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Start();
' DispatcherTimer setup
dispatcherTimer = New Threading.DispatcherTimer()
AddHandler dispatcherTimer.Tick, AddressOf dispatcherTimer_Tick
dispatcherTimer.Interval = New TimeSpan(0,0,1)
dispatcherTimer.Start()
注解
设置为IsEnabledfalse计时器启动时停止计时器。
设置为IsEnabledtrue计时器停止时启动计时器。