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 -> unit
Public Overrides Sub Initialize (component As IComponent)
参数
- component
- IComponent
一 Panel个 ,它实现一个 IComponent。
例外
示例
下面的代码示例演示如何重写 Initialize 从类继承的类中的方法,以更改在设计时派生自 PanelContainerDesigner 类的 Panel 控件的行为。 如果关联的控件不是ArgumentException对象,该示例将MyPanelContainer引发异常。
// 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
注解
视觉对象设计器在准备好使用设计器呈现控件时调用 Initialize 该方法 Panel 。 Initialize及其基本方法配置属性并设置设计器操作所需的事件。
参数 component 是 Panel 与此设计器或控件副本 Panel 关联的控件。