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.

继承
HandledEventHandler

注解

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.

适用于