Automation.AddAutomationEventHandler 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
註冊一個處理 使用者介面自動化 事件的方法。
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 方法提供一種機制,讓你能為這些事件註冊處理器。
適用於
另請參閱
- RemoveAutomationEventHandler(AutomationEvent, AutomationElement, AutomationEventHandler)
- AddAutomationFocusChangedEventHandler(AutomationFocusChangedEventHandler)
- AddAutomationPropertyChangedEventHandler(AutomationElement, TreeScope, AutomationPropertyChangedEventHandler, AutomationProperty[])
- AddStructureChangedEventHandler(AutomationElement, TreeScope, StructureChangedEventHandler)
- 訂閱UI自動化事件
- UI 自動化事件概觀