ComponentChangingEventArgs 类

定义

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

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

示例

以下示例演示如何创建 ComponentChangingEventArgs

public:
   // This example method creates a ComponentChangingEventArgs using the specified arguments.
   // Typically, this type of event args is created by a design mode subsystem.
   ComponentChangingEventArgs^ CreateComponentChangingEventArgs( Object^ component, MemberDescriptor^ member )
   {
      // The component that is about to change:       args.Component
      // The member that is about to change:          args.Member
      return gcnew ComponentChangingEventArgs( component,member );
   }
// This example method creates a ComponentChangingEventArgs using the specified arguments.
// Typically, this type of event args is created by a design mode subsystem.  
public ComponentChangingEventArgs CreateComponentChangingEventArgs(object component, MemberDescriptor member)
{
    ComponentChangingEventArgs args = new ComponentChangingEventArgs(component, member);

    // The component that is about to change:       args.Component
    // The member that is about to change:          args.Member

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

    ' The component that is about to change:       args.Component
    ' The member that is about to change:          args.Member

    Return args
End Function

注解

ComponentChangingEventArgs 提供有关事件 ComponentChanging 的数据。 事件 ComponentChanging 通知 IComponentChangeService 和注册的事件处理程序当前设计文档中的特定组件即将更改。 此事件提供了一种广泛可访问的方法,用于防止组件更改。

更改 ComponentChanging 组件之前会引发 事件。 此事件为设计者提供了中止更改的机会。 组件设计器通常自动引发 ComponentChanging 事件。 如果无法更改属性,则处理事件的方法可能会引发异常。 例如,如果将设计器文件签入源代码控制,则当用户拒绝检查文件时,此事件的处理程序通常会引发异常。

提供 ComponentChangingEventArgs 以下信息:

  • 一个 Component 属性,指示即将修改的组件。

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

继承者说明

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

构造函数

ComponentChangingEventArgs(Object, MemberDescriptor)

初始化 ComponentChangingEventArgs 类的新实例。

属性

Component

获取将要更改的组件或作为将要更改的成员的父容器的组件。

Member

获取将要更改的成员。

方法

Equals(Object)

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

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

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

(继承自 Object)

适用于

另请参阅