ListControlDesigner.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
一個由 ListControl 衍生出的控制,實作了一個 IComponent。
範例
以下程式碼範例覆蓋了從Initialize該類別衍生出的設計器中的方法ListControlDesigner,以確保自訂設計器只使用已命名SimpleRadioButtonList控制類別的實例。
此程式碼範例是本類別更大範例 ListControlDesigner 的一部分。
public override void Initialize(IComponent component)
{
// Ensure that only a SimpleRadioButtonList can be
// created in this designer.
Debug.Assert(
component is SimpleRadioButtonList,
"An invalid SimpleRadioButtonList control was initialized.");
simpleRadioButtonList = (SimpleRadioButtonList)component;
base.Initialize(component);
} // Initialize
Public Overrides Sub Initialize(ByVal component As IComponent)
' Ensure that only a SimpleRadioButtonList can be created
' in this designer.
Debug.Assert( _
TypeOf component Is SimpleRadioButtonList, _
"An invalid SimpleRadioButtonList control was initialized.")
simpleRadioButtonList = CType(component, SimpleRadioButtonList)
MyBase.Initialize(component)
End Sub
備註
當設計主機準備好使用設計器來渲染從Initialize類別衍生出的控制項時,會呼叫該ListControl方法。 該 Initialize 方法及其基礎方法配置屬性,並連接設計者操作所需的事件。
參數 component 是從 ListControl衍生出來的控制項,該控制項與此設計器相關聯,或是該控制項的複製品。