PanelContainerDesigner.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 -> unitPublic Overrides Sub Initialize (component As IComponent)参数
- component
- IComponent
一个 Panel,它实现 IComponent。
例外
示例
下面的代码示例演示如何重写 Initialize 从 PanelContainerDesigner 类继承的类中的 方法,以更改在设计时派生自 类的 Panel 控件的行为。 如果关联的控件不是 MyPanelContainer 对象,则此示例将引发ArgumentException异常。
// Initialize the designer.
public override void Initialize(IComponent component)
{
    // Ensure that only a MyPanelContainer can be created 
    // in this designer.
    if (!(component is MyPanelContainer))
        throw new ArgumentException();
    
    base.Initialize(component);
} // Initialize
' Initialize the designer.
Public Overrides Sub Initialize(ByVal component As IComponent)
    ' Ensure that only a MyPanelContainer can be created   
    ' in this designer. 
    If Not TypeOf component Is MyPanelContainer Then
        Throw New ArgumentException()
    End If
    MyBase.Initialize(component)
End Sub
注解
可视设计器在准备好使用设计器呈现Panel控件时调用 Initialize 方法。 Initialize及其基方法配置属性并设置设计器操作所需的事件。
              component参数是Panel与此设计器关联的控件或控件的副本Panel。