IComponentChangeService.ComponentChanged 事件

定义

在组件已更改时发生。Occurs when a component has been changed.

public:
 event System::ComponentModel::Design::ComponentChangedEventHandler ^ ComponentChanged;
event System.ComponentModel.Design.ComponentChangedEventHandler ComponentChanged;
member this.ComponentChanged : System.ComponentModel.Design.ComponentChangedEventHandler 
Event ComponentChanged As ComponentChangedEventHandler 

事件类型

ComponentChangedEventHandler

注解

当窗体上的任何组件更改时发生此事件。This event occurs when any component on the form changes. 此事件在窗体加载和卸载过程中不会发生,因为此时需要进行更改。This event will not occur during form load and unload, because changes are expected at this time.

备注

DesignerTransaction可以引发多个 ComponentChanged 事件。A DesignerTransaction can raise multiple ComponentChanged events. 某些 ComponentChanged 事件处理程序可能会干扰预期的事件序列,如代码在发生事务时更改属性的值。Some ComponentChanged event handlers can interfere with expected sequences of events, such as if your code alters the values of properties while a transaction is occurring. ComponentChanged如果事件处理程序在进行每次更改后绘制,事件处理程序也可能会影响性能 DesignerTransactionA ComponentChanged event handler can also impair performance if it draws after each change while a DesignerTransaction is in progress. 为了使 DesignerTransaction in 进程能够在不中断或不受 ComponentChanged 事件处理程序干扰的情况下完成,你可以测试属性的状态 InTransaction ,并在事务完成之前延迟处理更改事件,方法是添加一个 DesignerTransactionCloseEventHandler 将引发 ComponentChanged 事件处理程序的,并在事务完成时删除自身。In order to allow a DesignerTransaction in process to complete without interruption or interference by your ComponentChanged event handler, you can test the state of the InTransaction property, and defer handling the change events until the completion of the transaction by adding a DesignerTransactionCloseEventHandler which will raise your ComponentChanged event handler and remove itself upon completion of the transaction.

适用于

另请参阅