Timer 建構函式

定義

初始化 Timer 類別的新執行個體。

多載

名稱 Description
Timer()

初始化 Timer 類別的新執行個體。

Timer(IContainer)

初始化該類別的新實例 Timer 及指定的容器。

Timer()

初始化 Timer 類別的新執行個體。

public:
 Timer();
public Timer();
Public Sub New ()

備註

當新計時器被建立時,該計時器會被停用;也就是說, Enabled 設定為 false。 要啟用計時器,請呼叫該 Start 方法或設 Enabledtrue

如果計時器被停用且計時器超出範圍,當垃圾回收發生時,計時器會被丟棄。 如果計時器已啟用,即使它已經超出範圍,也不會受到垃圾回收的限制。

另請參閱

適用於

Timer(IContainer)

初始化該類別的新實例 Timer 及指定的容器。

public:
 Timer(System::ComponentModel::IContainer ^ container);
public Timer(System.ComponentModel.IContainer container);
new System.Windows.Forms.Timer : System.ComponentModel.IContainer -> System.Windows.Forms.Timer
Public Sub New (container As IContainer)

參數

container
IContainer

代表 IContainer 計時器的容器。

備註

Timer 構子讓你能將 a Timer 與任何 Container 物件關聯。 透過將 這樣關聯,你將 Timer 的生命 Timer 週期控制權交給了 Container。 如果你在申請中使用多個組件,並希望同時處理所有零件,這會非常有用。 例如,如果你將 a 、an ImageList、 和 a TimerContainer關聯起來ToolTip,則呼喚 Dispose 意志力處Container置所有這些組件。

當新計時器被建立時,該計時器會被停用;也就是說, Enabled 設定為 false。 要啟用計時器,請呼叫該 Start 方法或設 Enabledtrue

這個實例會一直存在,直到容器將其釋放到垃圾回收為止。

適用於