ComponentChangingEventHandler 대리자

정의

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

public delegate void ComponentChangingEventHandler(System::Object ^ sender, ComponentChangingEventArgs ^ e);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void ComponentChangingEventHandler(object sender, ComponentChangingEventArgs e);
public delegate void ComponentChangingEventHandler(object sender, ComponentChangingEventArgs e);
[<System.Runtime.InteropServices.ComVisible(true)>]
type ComponentChangingEventHandler = delegate of obj * ComponentChangingEventArgs -> unit
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 만들 때 이벤트를 처리할 메서드를 식별합니다. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 이벤트에 추가합니다. 대리자를 제거하지 않는 한 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다. 이벤트 처리기 대리에 대한 자세한 내용은 이벤트 처리 및 발생을 참조하세요.

확장명 메서드

Name Description
GetMethodInfo(Delegate)

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

적용 대상

추가 정보