ControlDesigner.OnComponentChanged(Object, ComponentChangedEventArgs) 方法

定义

在关联控件发生更改时调用。Called when the associated control changes.

public:
 virtual void OnComponentChanged(System::Object ^ sender, System::ComponentModel::Design::ComponentChangedEventArgs ^ ce);
public virtual void OnComponentChanged (object sender, System.ComponentModel.Design.ComponentChangedEventArgs ce);
abstract member OnComponentChanged : obj * System.ComponentModel.Design.ComponentChangedEventArgs -> unit
override this.OnComponentChanged : obj * System.ComponentModel.Design.ComponentChangedEventArgs -> unit
Public Overridable Sub OnComponentChanged (sender As Object, ce As ComponentChangedEventArgs)

参数

sender
Object

事件源。The source of the event.

ce
ComponentChangedEventArgs

包含事件数据的 ComponentChangedEventArgs 对象。A ComponentChangedEventArgs object that contains the event data.

注解

当关联控件的属性发生更改时,将调用 OnComponentChanged 方法。The OnComponentChanged method is called when a property on the associated control is changed. 它允许实施者执行任何在属性更改后可能需要的处理。It allows the implementer to do any processing that might be required after a property change. 调用 OnComponentChanged 方法将导致设计宿主调用 GetDesignTimeHtml 方法。Calling the OnComponentChanged method causes the design host to call the GetDesignTimeHtml method. OnComponentChanged 方法的基实现还会在页标记中保留控件。The base implementation of the OnComponentChanged method also persists the control in the page markup.

继承者说明

重写 OnComponentChanged(Object, ComponentChangedEventArgs) 方法,以便在保持控件之前和刷新设计时 HTML 标记之前提供附加处理。Override the OnComponentChanged(Object, ComponentChangedEventArgs) method to provide additional processing before persisting the control and before refreshing the design-time HTML markup.

在派生类中重写 OnComponentChanged(Object, ComponentChangedEventArgs) 方法时,请确保调用基类的 OnComponentChanged(Object, ComponentChangedEventArgs) 方法,以便注册的委托接收事件。When overriding the OnComponentChanged(Object, ComponentChangedEventArgs) method in a derived class, make sure that you call the OnComponentChanged(Object, ComponentChangedEventArgs) method for the base class so that registered delegates receive the event.

适用于

另请参阅