ComponentChangedEventArgs 类

定义

ComponentChanged 事件提供数据。 此类不能被继承。

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

示例

以下示例演示如何创建 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

注解

ComponentChangedEventArgs 提供事件的数据 ComponentChanged 。 事件 ComponentChanged 通知 IComponentChangeService 和注册的事件处理程序当前活动文档中的特定组件已更改。

提供 ComponentChangedEventArgs 以下信息:

  • 指示 Component 已修改的组件的属性。

  • 指示 Member 已更改的成员的属性。

  • 指示 NewValue 成员的新值的属性。

  • 指示 OldValue 成员的旧值的属性。

添加、删除或修改组件时,组件设计器通常会自动引发 ComponentChanged 事件。 ComponentChanged在窗体加载和卸载期间不会引发事件,因为此时需要更改。 组件设计器可能会在更改组件的属性后引发 ComponentChanged 事件;这可确保属性窗口将显示更新的属性。

继承者说明

如果将此类指定为另一个类的基类,则会发生编译器错误。

构造函数

ComponentChangedEventArgs(Object, MemberDescriptor, Object, Object)

初始化 ComponentChangedEventArgs 类的新实例。

属性

Component

获取已修改的组件。

Member

获取已更改的成员。

NewValue

获取已更改成员的新值。

OldValue

获取已更改成员的旧值。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅