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 提供一種機制,可讓您註冊這些事件的處理常式。

eventHandler可以是 方法的實例,或是Visual Basic) 中方法 (AddressOf 的參考。

適用於

另請參閱