語言

Automation.AddAutomationEventHandler 方法

定義

註冊一個處理 使用者介面自動化 事件的方法。

public:
 static void AddAutomationEventHandler(System::Windows::Automation::AutomationEvent ^ eventId, System::Windows::Automation::AutomationElement ^ element, System::Windows::Automation::TreeScope scope, System::Windows::Automation::AutomationEventHandler ^ eventHandler);
public static void AddAutomationEventHandler(System.Windows.Automation.AutomationEvent eventId, System.Windows.Automation.AutomationElement element, System.Windows.Automation.TreeScope scope, System.Windows.Automation.AutomationEventHandler eventHandler);
static member AddAutomationEventHandler : System.Windows.Automation.AutomationEvent * System.Windows.Automation.AutomationElement * System.Windows.Automation.TreeScope * System.Windows.Automation.AutomationEventHandler -> unit
Public Shared Sub AddAutomationEventHandler (eventId As AutomationEvent, element As AutomationElement, scope As TreeScope, eventHandler As AutomationEventHandler)

參數

eventId
AutomationEvent

方法是方法將處理的事件識別碼。

element
AutomationElement

用 使用者介面自動化 元素來關聯事件處理程式。

scope
TreeScope

要處理的事件範圍;也就是說,無論是存在於元素本身,還是其祖先與後代。

eventHandler
AutomationEventHandler

當指定事件發生時呼叫的方法。

備註

有些類別,例如 GridPattern,會暴露識別該類別特有事件的欄位。 此 AddAutomationEventHandler 方法提供一種機制,讓你能為這些事件註冊處理器。

可以是該方法的一個實例,也可以是對該方法的參考()。

適用於

另請參閱