ComponentChangedEventArgs 类

定义

ComponentChanged 事件提供数据。Provides data for the ComponentChanged event. 此类不能被继承。This class cannot be inherited.

public ref class ComponentChangedEventArgs sealed : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComponentChangedEventArgs : EventArgs
type ComponentChangedEventArgs = class
    inherit EventArgs
Public NotInheritable Class ComponentChangedEventArgs
Inherits EventArgs
继承
ComponentChangedEventArgs
属性

示例

下面的示例演示如何创建ComponentChangedEventArgsThe following example demonstrates creating a ComponentChangedEventArgs.

public:
   // This example method creates a ComponentChangedEventArgs using the specified arguments.
   // Typically, this type of event args is created by a design mode subsystem.
   ComponentChangedEventArgs^ CreateComponentChangedEventArgs( Object^ component, MemberDescriptor^ member, Object^ oldValue, Object^ newValue )
   {
      // Creates a component changed event args with the specified arguments.
      ComponentChangedEventArgs^ args = gcnew ComponentChangedEventArgs( component, member, oldValue, newValue );
      
      // The component that has changed:              args->Component
      // The member of the component that changed:    args->Member
      // The old value of the member:                 args->oldValue
      // The new value of the member:                 args->newValue
      return args;
   }
// This example method creates a ComponentChangedEventArgs using the specified arguments.
// Typically, this type of event args is created by a design mode subsystem.            
public ComponentChangedEventArgs CreateComponentChangedEventArgs(object component, MemberDescriptor member, object oldValue, object newValue)
{            
    // Creates a component changed event args with the specified arguments.
    ComponentChangedEventArgs args = new ComponentChangedEventArgs(component, member, oldValue, newValue);

    // The component that has changed:              args.Component
    // The member of the component that changed:    args.Member
    // The old value of the member:                 args.oldValue
    // The new value of the member:                 args.newValue

    return args;            
}
' This example method creates a ComponentChangedEventArgs using the specified arguments.
' Typically, this type of event args is created by a design mode subsystem.            
Public Function CreateComponentChangedEventArgs(ByVal component As Object, ByVal member As MemberDescriptor, ByVal oldValue As Object, ByVal newValue As Object) As ComponentChangedEventArgs
    ' Creates a component changed event args with the specified arguments.
    Dim args As New ComponentChangedEventArgs(component, member, oldValue, newValue)

    ' The component that has changed:              args.Component
    ' The member of the component that changed:    args.Member
    ' The old value of the member:                 args.oldValue
    ' The new value of the member:                 args.newValue
    Return args
End Function

注解

ComponentChangedEventArgsComponentChanged事件提供数据。ComponentChangedEventArgs provides data for a ComponentChanged event. ComponentChanged 事件IComponentChangeService通知和注册的事件处理程序, 当前活动文档中的特定组件已被更改。The ComponentChanged event notifies the IComponentChangeService and registered event handlers that a particular component in the currently active document has been changed.

ComponentChangedEventArgs提供以下信息:A ComponentChangedEventArgs provides the following information:

  • 指示已修改的组件的属性。ComponentA Component property that indicates the component that was modified.

  • 指示已更改的成员的属性。MemberA Member property that indicates the member that was changed.

  • 一个NewValue属性, 该属性指示成员的新值。A NewValue property that indicates the new value of the member.

  • 指示成员的旧值的属性。OldValueAn OldValue property that indicates the old value of the member.

添加、删除或修改ComponentChanged组件时, 组件设计器通常会自动引发事件。Component designers typically raise the ComponentChanged event automatically when components are added, removed, or modified. 在窗体加载和卸载过程中不会引发事件,因为此时需要进行更改。ComponentChangedA ComponentChanged event is not raised during form load and unload because changes at this time are expected. 组件设计器可能会在ComponentChanged更改组件的属性后引发事件; 这可确保属性窗口将显示已更新的属性。A component designer might raise the ComponentChanged event after it changes a property of the component; this ensures that the Properties window will display the updated property.

继承者说明

如果将此类指定为其他类的基类, 则会出现编译器错误。A compiler error occurs if this class is specified as the base class of another class.

构造函数

ComponentChangedEventArgs(Object, MemberDescriptor, Object, Object)

初始化 ComponentChangedEventArgs 类的新实例。Initializes a new instance of the ComponentChangedEventArgs class.

属性

Component

获取已修改的组件。Gets the component that was modified.

Member

获取已更改的成员。Gets the member that has been changed.

NewValue

获取已更改成员的新值。Gets the new value of the changed member.

OldValue

获取已更改成员的旧值。Gets the old value of the changed member.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅