CancelEventHandler 代理人

定義

表示處理可取消事件的方法。Represents the method that handles a cancelable event.

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

參數

sender
Object

事件的來源。The source of the event.

e
CancelEventArgs

CancelEventArgs,其中包含事件資料。A CancelEventArgs that contains the event data.

繼承
CancelEventHandler

範例

如需如何使用CancelEventHandler委派的範例, 請參閱CancelEventArgs類別中的範例程式碼。For an example of how to use the CancelEventHandler delegate, please see the sample code in the CancelEventArgs class.

備註

建立 CancelEventHandler 委派時,必須識別處理事件的方法。When you create a CancelEventHandler delegate, you identify the method that will handle the event. 若要使事件與您的事件處理常式產生關聯,請將委派的執行個體 (Instance) 加入至事件。To associate the event with your event handler, add an instance of the delegate to the event. 事件處理常式方法會在事件發生時呼叫, 除非您移除委派。The event-handler method is called whenever the event occurs, unless you remove the delegate. 如需事件處理常式委派的詳細資訊, 請參閱處理和引發事件For more information about event-handler delegates, see Handling and Raising Events.

擴充方法

GetMethodInfo(Delegate)

取得表示特定委派所代表之方法的物件。Gets an object that represents the method represented by the specified delegate.

適用於

另請參閱