コレクション内の指定した名前を持つイベントの説明を取得します。
Public Overridable Function Find( _
ByVal name As String, _ ByVal ignoreCase As Boolean _) As EventDescriptor
[C#]
public virtual EventDescriptor Find(stringname,boolignoreCase);
[C++]
public: virtual EventDescriptor* Find(String* name,boolignoreCase);
[JScript]
public function Find(
name : String,ignoreCase : Boolean) : EventDescriptor;
パラメータ
- name
コレクションから取得するイベントの名前。 - ignoreCase
イベントの大文字と小文字を区別しない場合は true 。それ以外の場合は false 。
戻り値
指定した名前の EventDescriptor 。イベントが存在しない場合は null 参照 (Visual Basic では Nothing) 。
使用例
[Visual Basic, C#, C++] 特定の EventDescriptor を検索する例を次に示します。見つかった EventDescriptor のコンポーネントの型をテキスト ボックスに出力します。この例は、 button1
と textBox1
がフォーム上でインスタンス化されていることを前提としています。
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 'FindEvent
[C#]
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 = myEvent.Name + ": " + myEvent.Description;
}
[C++]
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(S"Resize", false);
// Prints the event name and event description.
textBox1->Text = String::Concat( myEvent->Name, S": ", myEvent->Description );
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
EventDescriptorCollection クラス | EventDescriptorCollection メンバ | System.ComponentModel 名前空間 | EventDescriptor | TypeDescriptor