DataGridDesigner.Initialize(IComponent) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化設計者並使用指定的 DataGrid 控制項。
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
控制元件正在設計中。
範例
以下程式碼範例說明如何覆寫該 Initialize 方法,確保設計者僅以類別的 SimpleDataGrid 實例初始化。
此程式碼範例是本類別更大範例 DataGridDesigner 的一部分。
' Override the Initialize method to ensure that
' only an instance of the SimpleDataList class is
' used by this designer class.
Public Overrides Sub Initialize(ByVal component As IComponent)
simpleList = CType(component, SimpleDataList)
If IsNothing(simpleList) Then
Throw New ArgumentException("Must be a SimpleDataList.", "component")
End If
MyBase.Initialize(component)
End Sub