HandledEventHandler 委托

定义

表示可以处理事件的方法,这些事件在事件处理程序返回后可能需要或不需要进行进一步处理。Represents a method that can handle events which may or may not require further processing after the event handler has returned.

public delegate void HandledEventHandler(System::Object ^ sender, HandledEventArgs ^ e);
public delegate void HandledEventHandler(object sender, HandledEventArgs e);
type HandledEventHandler = delegate of obj * HandledEventArgs -> unit
Public Delegate Sub HandledEventHandler(sender As Object, e As HandledEventArgs)

参数

sender
Object

事件源。The source of the event.

e
HandledEventArgs

包含事件数据的 HandledEventArgsA HandledEventArgs that contains the event data.

注解

HandledEventArgs.Handled 属性提供足够的事件数据时,可以将此委托用于自己的事件。This delegate is available for use with your own events when the HandledEventArgs.Handled property provides sufficient event data. Handled true 如果处理程序中已完成所有必要的处理,事件处理程序可以将属性设置为。The event handler can set the Handled property to true if all necessary processing has been completed in the handler.

通常,需要此功能的事件还需要其他事件数据,并将使用派生自的类 HandledEventArgs 以及相应的、具有相似名称的委托类型。Typically, events that require this functionality will also require additional event data, and will use a class that derives from HandledEventArgs along with a corresponding, similarly-named delegate type. 例如, DataGridView.RowPrePaint 事件使用 DataGridViewRowPrePaintEventArgs 事件数据类型和 DataGridViewRowPrePaintEventHandler 委托类型。For example, the DataGridView.RowPrePaint event uses the DataGridViewRowPrePaintEventArgs event-data type and the DataGridViewRowPrePaintEventHandler delegate type. 由于委托不是继承的,因此 HandledEventHandler 很少使用。Because delegates are not inherited, the HandledEventHandler is rarely used.

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

适用于