ComponentRenameEventHandler 代理人
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ComponentRename イベントを処理するメソッドを表します。
public delegate void ComponentRenameEventHandler(System::Object ^ sender, ComponentRenameEventArgs ^ e);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void ComponentRenameEventHandler(object sender, ComponentRenameEventArgs e);
public delegate void ComponentRenameEventHandler(object sender, ComponentRenameEventArgs e);
[<System.Runtime.InteropServices.ComVisible(true)>]
type ComponentRenameEventHandler = delegate of obj * ComponentRenameEventArgs -> unit
type ComponentRenameEventHandler = delegate of obj * ComponentRenameEventArgs -> unit
Public Delegate Sub ComponentRenameEventHandler(sender As Object, e As ComponentRenameEventArgs)
パラメーター
- sender
- Object
イベントのソース。
イベント データを含む ComponentRenameEventArgs 。
- 属性
例
次の例では、 ComponentRenameEventHandler の登録と ComponentRename イベントの処理を示します。
public:
void LinkComponentRenameEvent( IComponentChangeService^ changeService )
{
// Registers an event handler for the ComponentRename event.
changeService->ComponentRename += gcnew ComponentRenameEventHandler(
this, &ComponentRenameEventHandlerExample::OnComponentRename );
}
private:
void OnComponentRename( Object^ /*sender*/, ComponentRenameEventArgs^ e )
{
// Displayss component renamed information on the console.
Console::WriteLine( "Type of the component that has been renamed: " +
e->Component->GetType()->FullName );
Console::WriteLine( "New name of the component that has been renamed: " +
e->NewName );
Console::WriteLine( "Old name of the component that has been renamed: " +
e->OldName );
}
public void LinkComponentRenameEvent(IComponentChangeService changeService)
{
// Registers an event handler for the ComponentRename event.
changeService.ComponentRename += new ComponentRenameEventHandler(this.OnComponentRename);
}
private void OnComponentRename(object sender, ComponentRenameEventArgs e)
{
// Displayss component renamed information on the console.
Console.WriteLine("Type of the component that has been renamed: "+e.Component.GetType().FullName);
Console.WriteLine("New name of the component that has been renamed: "+e.NewName);
Console.WriteLine("Old name of the component that has been renamed: "+e.OldName);
}
Public Sub LinkComponentRenameEvent(ByVal changeService As IComponentChangeService)
' Registers an event handler for the ComponentRename event.
AddHandler changeService.ComponentRename, AddressOf Me.OnComponentRename
End Sub
Private Sub OnComponentRename(ByVal sender As Object, ByVal e As ComponentRenameEventArgs)
' Displays component renamed information on the console.
Console.WriteLine(("Type of the component that has been renamed: " + e.Component.GetType().FullName))
Console.WriteLine(("New name of the component that has been renamed: " + e.NewName))
Console.WriteLine(("Old name of the component that has been renamed: " + e.OldName))
End Sub
注釈
ComponentRenameEventHandler デリゲートを作成するときは、イベントを処理するメソッドを識別します。 イベントをイベント ハンドラーに関連付けるには、デリゲートのインスタンスをイベントに追加します。 デリゲートを削除しない限り、イベントが発生するたびにイベント ハンドラーが呼び出されます。 イベント ハンドラー デリゲートの詳細については、「イベントの 処理と発生」を参照してください。
拡張メソッド
| 名前 | 説明 |
|---|---|
| GetMethodInfo(Delegate) |
指定したデリゲートによって表されるメソッドを表すオブジェクトを取得します。 |