Rediger

Del via


ListControlDesigner.Initialize(IComponent) Method

Definition

Prepares the designer to view, edit, and design the associated control.

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)

Parameters

component
IComponent

A control derived from the ListControl that implements an IComponent.

Examples

The following code example overrides the Initialize method in a designer derived from the ListControlDesigner class to ensure that only instances of a control class named SimpleRadioButtonList are used by the custom designer.

This code example is part of a larger example provided for the ListControlDesigner class.

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

Remarks

The designer host calls the Initialize method when it is ready to use the designer to render the control that is derived from the ListControl class. The Initialize method and its base methods configure properties and connect to events that are necessary for the operation of the designer.

The component parameter is the control, derived from the ListControl, that is associated with this designer or is a copy of that control.

Applies to

See also