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

HandledEventArgs,其中包含事件資料。A 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.

適用於