ActiveDesignerEventHandler Delegate

 

Represents the method that will handle the ActiveDesignerChanged event.

Namespace:   System.ComponentModel.Design
Assembly:  System (in System.dll)

[HostProtectionAttribute(SecurityAction::LinkDemand, SharedState = true)]
public delegate void ActiveDesignerEventHandler(
	Object^ sender,
	ActiveDesignerEventArgs^ e
)

Parameters

sender
Type: System::Object^

The source of the event.

e
Type: System.ComponentModel.Design::ActiveDesignerEventArgs^

An ActiveDesignerEventArgs that contains the event data.

The ActiveDesignerChanged event is raised when the currently active document has been modified.

When you create an ActiveDesignerEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see NIB: Events and Delegates.

The following example demonstrates registering an ActiveDesignerEventHandler and handling an ActiveDesignerChanged event.

public:
   void LinkActiveDesignerEvent( IDesignerEventService^ eventService )
   {
      // Registers an event handler for the ActiveDesignerChanged event.
      eventService->ActiveDesignerChanged += gcnew ActiveDesignerEventHandler( this, &MiscCompModSamples::ActiveDesignerEventHandlerExample::OnActiveDesignerEvent );
   }

private:
   void OnActiveDesignerEvent( Object^ /*sender*/, ActiveDesignerEventArgs^ e )
   {
      // Displays changed designer information on the console.
      if ( e->NewDesigner->RootComponent->Site != nullptr )
      {
         Console::WriteLine( "Name of the component of the new active designer: {0}", e->NewDesigner->RootComponent->Site->Name );
      }
      Console::WriteLine( "Type of the component of the new active designer: {0}", e->NewDesigner->RootComponentClassName );
      if ( e->OldDesigner->RootComponent->Site != nullptr )
      {
         Console::WriteLine( "Name of the component of the previously active designer: {0}", e->OldDesigner->RootComponent->Site->Name );
      }
      Console::WriteLine( "Type of the component of the previously active designer: {0}", e->OldDesigner->RootComponentClassName );
   }

.NET Framework
Available since 1.1
Return to top
Show: