閱讀英文

共用方式為


HandledEventHandler 代理人

定義

表示方法,在事件處理常式傳回後,這個方法可以處理不一定需要進一步處理的事件。

C#
public delegate void HandledEventHandler(object sender, HandledEventArgs e);
C#
public delegate void HandledEventHandler(object? sender, HandledEventArgs e);

參數

sender
Object

事件的來源。

e
HandledEventArgs

HandledEventArgs,其中包含事件資料。

備註

當 屬性提供足夠的事件數據時, HandledEventArgs.Handled 此委派可用於您自己的事件。 如果處理程式中已完成所有必要的處理,事件處理程式可以將 屬性設定 Handledtrue

一般而言,需要這項功能的事件也需要額外的事件數據,並使用衍生自 HandledEventArgs 的類別以及對應的類似名稱委派類型。 例如,事件 DataGridView.RowPrePaint 會使用 DataGridViewRowPrePaintEventArgs 事件數據類型和 DataGridViewRowPrePaintEventHandler 委派類型。 因為不會繼承委派, HandledEventHandler 所以很少使用 。

擴充方法

GetMethodInfo(Delegate)

取得表示特定委派所代表之方法的物件。

適用於

產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1