語言

Control.OnLoad(EventArgs) 方法

定義

引發 Load 事件。

protected:
 virtual void OnLoad(EventArgs ^ e);
protected public:
 virtual void OnLoad(EventArgs ^ e);
protected virtual void OnLoad(EventArgs e);
protected internal virtual void OnLoad(EventArgs e);
abstract member OnLoad : EventArgs -> unit
override this.OnLoad : EventArgs -> unit
Protected Overridable Sub OnLoad (e As EventArgs)
Protected Friend Overridable Sub OnLoad (e As EventArgs)

參數

e
EventArgs

包含事件資料的 EventArgs 物件。

範例

// Override the OnLoad method to set _text to
// a default value if it is null.
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    if (_text == null)
        _text = "Here is some default text.";
}
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
    MyBase.OnLoad(e)
    If _text Is Nothing Then
        _text = "Here is some default text."
    End If
End Sub

備註

ASP.NET 呼叫此方法來提升 Load 事件。 如果你正在開發自訂控制,可以覆寫此方法以提供額外的處理。 如果你覆寫了這個方法,請呼叫基地控制 OnLoad 的方法來通知訂閱者事件。

適用於

另請參閱