다음을 통해 공유


ComponentRenameEventHandler 대리자

정의

ComponentRename 이벤트를 처리할 메서드를 나타냅니다.

public delegate void ComponentRenameEventHandler(System::Object ^ sender, ComponentRenameEventArgs ^ e);
public delegate void ComponentRenameEventHandler(object sender, ComponentRenameEventArgs e);
public delegate void ComponentRenameEventHandler(object? sender, ComponentRenameEventArgs e);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void ComponentRenameEventHandler(object sender, ComponentRenameEventArgs e);
type ComponentRenameEventHandler = delegate of obj * ComponentRenameEventArgs -> unit
[<System.Runtime.InteropServices.ComVisible(true)>]
type ComponentRenameEventHandler = delegate of obj * ComponentRenameEventArgs -> unit
Public Delegate Sub ComponentRenameEventHandler(sender As Object, e As ComponentRenameEventArgs)

매개 변수

sender
Object

이벤트 소스입니다.

e
ComponentRenameEventArgs

이벤트 데이터를 포함하는 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)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

추가 정보