EventDescriptor クラス

定義

イベントに関する情報を提供します。

public ref class EventDescriptor abstract : System::ComponentModel::MemberDescriptor
public abstract class EventDescriptor : System.ComponentModel.MemberDescriptor
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class EventDescriptor : System.ComponentModel.MemberDescriptor
type EventDescriptor = class
    inherit MemberDescriptor
[<System.Runtime.InteropServices.ComVisible(true)>]
type EventDescriptor = class
    inherit MemberDescriptor
Public MustInherit Class EventDescriptor
Inherits MemberDescriptor
継承
EventDescriptor
属性

次のコード例は、 クラスの 例に EventDescriptorCollection 基づいて構築されています。 各イベントの情報 (カテゴリ、説明、表示名) をテキスト ボックスのボタンに出力します。 フォームで と textbox1button1インスタンス化されている必要があります。

EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );

// Displays each event's information in the collection in a text box.
for each (EventDescriptor^ myEvent in events) {
    textBox1->Text += myEvent->Category + '\n';
    textBox1->Text += myEvent->Description + '\n';
    textBox1->Text += myEvent->DisplayName + '\n';
}
EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);
// Displays each event's information in the collection in a text box.
foreach (System.ComponentModel.EventDescriptor myEvent in events) {
    textBox1.Text += myEvent.Category + '\n';
    textBox1.Text += myEvent.Description + '\n';
    textBox1.Text += myEvent.DisplayName + '\n';
}
Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(Button1)
' Displays each event's information in the collection in a text box.
Dim myEvent As EventDescriptor
For Each myEvent In events
    TextBox1.Text &= myEvent.Category & ControlChars.Cr
    TextBox1.Text &= myEvent.Description & ControlChars.Cr
    TextBox1.Text &= myEvent.DisplayName & ControlChars.Cr
Next myEvent

注釈

EventDescriptor 、名前、その属性、イベントがバインドされるコンポーネント、イベント デリゲート、デリゲートの種類、デリゲートがマルチキャストであるかどうかを示します。

EventDescriptor には、次 abstract のプロパティとメソッドが用意されています。

  • ComponentType には、このイベントが宣言されているコンポーネントの型が含まれています。

  • EventType には、イベントのデリゲートの型が含まれています。

  • IsMulticast には、イベント デリゲートがマルチキャスト デリゲートであるかどうかを示す値が含まれています。

  • AddEventHandler は、イベントをコンポーネントにバインドします。

  • RemoveEventHandler デリゲートがコンポーネントからイベントを受信しなくなったように、コンポーネントからデリゲートをバインド解除します。

イベントの詳細については、「イベントの 処理と発生」を参照してください。 リフレクションの詳細については、「リフレクション 」のトピックを参照してください。

コンストラクター

EventDescriptor(MemberDescriptor)

指定した EventDescriptor 内の名前と属性を使用して、MemberDescriptor クラスの新しいインスタンスを初期化します。

EventDescriptor(MemberDescriptor, Attribute[])

指定した EventDescriptor 内の名前と、MemberDescriptor および MemberDescriptor 配列の両方に格納されている属性を使用して、Attribute クラスの新しいインスタンスを初期化します。

EventDescriptor(String, Attribute[])

名前と属性配列を指定して、EventDescriptor クラスの新しいインスタンスを初期化します。

プロパティ

AttributeArray

属性の配列を取得または設定します。

(継承元 MemberDescriptor)
Attributes

メンバーの属性のコレクションを取得します。

(継承元 MemberDescriptor)
Category

CategoryAttribute で指定されている、メンバーが属するカテゴリの名前を取得します。

(継承元 MemberDescriptor)
ComponentType

派生クラスでオーバーライドされた場合、イベントが関連付けられているコンポーネントの型を取得します。

Description

DescriptionAttribute で指定されている、メンバーの説明を取得します。

(継承元 MemberDescriptor)
DesignTimeOnly

DesignOnlyAttribute で指定されている、メンバーを設定できるのがデザイン時だけかどうかを示す値を取得します。

(継承元 MemberDescriptor)
DisplayName

[プロパティ] ウィンドウなどのウィンドウに表示できる名前を取得します。

(継承元 MemberDescriptor)
EventType

派生クラスでオーバーライドされた場合、イベントのデリゲートの型を取得します。

IsBrowsable

BrowsableAttribute で指定されている、メンバーが参照可能かどうかを示す値を取得します。

(継承元 MemberDescriptor)
IsMulticast

派生クラスでオーバーライドされた場合、イベント デリゲートがマルチキャスト デリゲートかどうかを示す値を取得します。

Name

メンバーの名前を取得します。

(継承元 MemberDescriptor)
NameHashCode

GetHashCode() で指定されている、メンバーの名前のハッシュ コードを取得します。

(継承元 MemberDescriptor)

メソッド

AddEventHandler(Object, Delegate)

派生クラスでオーバーライドされた場合、イベントをコンポーネントに関連付けます。

CreateAttributeCollection()

コンストラクターに渡された属性配列を使用して、属性のコレクションを作成します。

(継承元 MemberDescriptor)
Equals(Object)

現在のインスタンスと指定したオブジェクトを比較して、等しいかどうかを確認します。

(継承元 MemberDescriptor)
FillAttributes(IList)

派生クラスでオーバーライドされた場合、親クラスの指定した属性リストに継承クラスの属性を追加します。

(継承元 MemberDescriptor)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 MemberDescriptor)
GetInvocationTarget(Type, Object)

メンバーの呼び出し中に使用するオブジェクトを取得します。

(継承元 MemberDescriptor)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
RemoveEventHandler(Object, Delegate)

派生クラスでオーバーライドされた場合、コンポーネントとデリゲートの関連付けを解除し、デリゲートがコンポーネントからイベントを受信しなくなるようにします。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください