LoginViewDesigner.Initialize(IComponent) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
讓設計師準備好檢視、編輯及設計相關的控制項。
public:
override void Initialize(System::ComponentModel::IComponent ^ component);
public override void Initialize(System.ComponentModel.IComponent component);
override this.Initialize : System.ComponentModel.IComponent -> unit
Public Overrides Sub Initialize (component As IComponent)
參數
- component
- IComponent
A LoginView,實現了一個 IComponent。
例外狀況
範例
以下程式碼範例說明如何覆寫 Initialize 從該類別繼承 LoginViewDesigner 的方法,以改變設計時從類別衍生 LoginView 出的控制項的行為。 若相關控制項不是ArgumentException物件,範例會拋出 。MyLoginView
public override void Initialize(IComponent component)
{
// Ensure that only a MyLoginView can be created in this designer.
if (!(component is MyLoginView))
throw new ArgumentException();
// Call the base method to generate the markup.
base.Initialize(component);
} // Initialize
' Generate the design time markup.
Public Overrides Sub Initialize(ByVal component As IComponent)
' Ensure that only a MyLoginView can be created in this designer.
If Not TypeOf component Is MyLoginView Then
Throw New ArgumentException()
End If
' Call the base method to generate the markup.
MyBase.Initialize(component)
End Sub
備註
視覺化設計器在準備好使用設計器來渲染Initialize控制項時呼叫該LoginView方法。 這些 Initialize 方法及其基礎方法會配置屬性並設定設計者操作所需的事件。
參數 component 是 LoginView 與此設計器相關的控制項,或是控制項的 LoginView 副本。