다음을 통해 공유


ComponentChangingEventHandler 대리자

정의

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

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

매개 변수

sender
Object

이벤트 소스입니다.

e
ComponentChangingEventArgs

이벤트 데이터가 들어 있는 ComponentChangingEventArgs 이벤트입니다.

특성

예제

이 예제에서는 등록 하 고 ComponentChangingEventHandler 이벤트를 처리 하는 방법을 보여 줍니다 ComponentChanging .

public:
   void LinkComponentChangingEvent( IComponentChangeService^ changeService )
   {
      // Registers an event handler for the ComponentChanging event.
      changeService->ComponentChanging += gcnew ComponentChangingEventHandler(
         this, &ComponentChangingEventHandlerExample::OnComponentChanging );
   }

private:
   void OnComponentChanging( Object^ sender, ComponentChangingEventArgs^ e )
   {
      // Displays changing component information on the console.
      Console::WriteLine( "Type of the component that is about to change: " +
         e->Component->GetType()->FullName );
      Console::WriteLine( "Name of the member of the component that is about to change: " +
         e->Member->Name );
   }
public void LinkComponentChangingEvent(IComponentChangeService changeService)
{
    // Registers an event handler for the ComponentChanging event.
    changeService.ComponentChanging += new ComponentChangingEventHandler(this.OnComponentChanging);            
}

private void OnComponentChanging(object sender, ComponentChangingEventArgs e)
{
    // Displays changing component information on the console.
    Console.WriteLine("Type of the component that is about to change: "+e.Component.GetType().FullName);      
    Console.WriteLine("Name of the member of the component that is about to change: "+e.Member.Name);                        
}
Public Sub LinkComponentChangingEvent(ByVal changeService As IComponentChangeService)
    ' Registers an event handler for the ComponentChanging event.
    AddHandler changeService.ComponentChanging, AddressOf Me.OnComponentChanging
End Sub

Private Sub OnComponentChanging(ByVal sender As Object, ByVal e As ComponentChangingEventArgs)
    ' Displays changing component information on the console.
    Console.WriteLine(("Type of the component that is about to change: " + e.Component.GetType().FullName))
    Console.WriteLine(("Name of the member of the component that is about to change: " + e.Member.Name))
End Sub

설명

ComponentChangingEventHandler 대리자를 만들 때, 이벤트를 처리할 메서드를 식별합니다. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 해당 이벤트에 추가합니다. 대리자를 제거하지 않는 경우 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다. 이벤트 처리기 대리자에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

확장 메서드

GetMethodInfo(Delegate)

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

적용 대상

추가 정보