EventDescriptor クラス

定義

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

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

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

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, Attribute[])

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

EventDescriptor(MemberDescriptor)

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

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)

適用対象

こちらもご覧ください