ITypeDescriptorContext.OnComponentChanging Method


引发 ComponentChanging 事件。Raises the ComponentChanging event.

 bool OnComponentChanging();
public bool OnComponentChanging ();
abstract member OnComponentChanging : unit -> bool
Public Function OnComponentChanging () As Boolean



如果该对象可以更改,则为 true;否则为 falsetrue if this object can be changed; otherwise, false.


使用 OnComponentChanging 方法发送有关对象的实例将要更改的通知。Use the OnComponentChanging method to send notification that an instance of an object is about to be changed. 此方法还会返回一个值,该值指示是否可以更改此对象。This method also returns a value indicating whether this object can be changed. 返回 false 时,请不要更改对象。When false is returned, do not change the object.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅处理和引发事件For more information, see Handling and Raising Events.

OnComponentChanging 方法还允许派生类对事件进行处理而不必附加委托。The OnComponentChanging method also allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

Notes to Implementers

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

Applies to

See also