Export (0) Print
Expand All

EventHandlerService Class

Provides a systematic way to manage event handlers for the current document.

System.Object
  System.Windows.Forms.Design.EventHandlerService

Namespace:  System.Windows.Forms.Design
Assembly:  System.Design (in System.Design.dll)

public sealed class EventHandlerService

The EventHandlerService type exposes the following members.

  NameDescription
Public methodEventHandlerServiceInitializes a new instance of the EventHandlerService class.
Top

  NameDescription
Public propertyFocusWindowGets the control to which event handlers are attached.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHandlerGets the currently active event handler of the specified type.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodPopHandlerPops the given handler off of the stack.
Public methodPushHandlerPushes a new event handler on the stack.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventEventHandlerChangedFires an OnEventHandlerChanged event.
Top

Developers may want to be able to write code in one place that handles events of a certain type.

Also, developers may need to globally change the behavior of the handlers for specific events or types of events, which may be distributed among designer components.

The designers for a typical project are many different objects so it can be useful to list and store reference to these events from a common place.

This service implements an "event stack" that contains the current set of event handlers. The stack may have a variety of different types of handlers on the stack.

For example, a designer might push, or add, a keyboard handler and a mouse handler onto the stack. When a designer requests an event handler, the service will find the topmost handler on the stack that matches the class you requested.

This way the service can be extended to any eventing scheme, and it also allows specific types of event handlers to be replaced. For example, you can replace mouse event handlers without affecting menu event handlers or keyboard event handlers.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft