EventDescriptorCollection.Find(String, Boolean) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクション内の指定した名前を持つイベントの説明を取得します。
public:
virtual System::ComponentModel::EventDescriptor ^ Find(System::String ^ name, bool ignoreCase);
public virtual System.ComponentModel.EventDescriptor? Find(string name, bool ignoreCase);
public virtual System.ComponentModel.EventDescriptor Find(string name, bool ignoreCase);
abstract member Find : string * bool -> System.ComponentModel.EventDescriptor
override this.Find : string * bool -> System.ComponentModel.EventDescriptor
Public Overridable Function Find (name As String, ignoreCase As Boolean) As EventDescriptor
パラメーター
- name
- String
コレクションから取得するイベントの名前。
- ignoreCase
- Boolean
true イベントの大文字と小文字を無視する場合。それ以外の場合は false。
返品
指定した名前の EventDescriptor 。イベントが存在しない場合は null 。
例
次のコード例では、特定の EventDescriptorを検索します。 この EventDescriptor のコンポーネントの種類をテキスト ボックスに出力します。 フォームで button1 と textBox1 がインスタンス化されている必要があります。
private:
void FindEvent()
{
// Creates a new collection and assigns it the events for button1.
EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
// Sets an EventDescriptor to the specific event.
EventDescriptor^ myEvent = events->Find( "Resize", false );
// Prints the event name and event description.
textBox1->Text = String::Concat( myEvent->Name, ": ", myEvent->Description );
}
void FindEvent()
{
// Creates a new collection and assigns it the events for button1.
EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);
// Sets an EventDescriptor to the specific event.
EventDescriptor myEvent = events.Find("Resize", false);
// Prints the event name and event description.
textBox1.Text = myEvent.Name + ": " + myEvent.Description;
}
Private Sub FindEvent()
' Creates a new collection and assigns it the events for button1.
Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
' Sets an EventDescriptor to the specific event.
Dim myEvent As EventDescriptor = events.Find("Resize", False)
' Prints the event name and event description.
textBox1.Text = myEvent.Name & ": " & myEvent.Description
End Sub
注釈
注
このクラスに適用される HostProtectionAttribute 属性には、次の Resources プロパティ値があります: Synchronization。 HostProtectionAttributeはデスクトップ アプリケーションには影響しません (通常、アイコンをダブルクリックするか、コマンドを入力するか、ブラウザーで URL を入力します)。 詳細については、 HostProtectionAttribute クラスまたは SQL Server プログラミング属性とホスト保護属性に関するページを参照してください。