Automation.AddAutomationEventHandler Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Registers a method that handles UI Automation events.
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
The identifier for the event the method will handle.
- element
- AutomationElement
The UI Automation element to associate with the event handler.
- scope
- TreeScope
The scope of events to be handled; that is, whether they are on the element itself, or on its ancestors and descendants.
- eventHandler
- AutomationEventHandler
The method to call when the specified event occurs.
Some classes, such as GridPattern, expose fields identifying events that are specific to the class. The AddAutomationEventHandler method provides a mechanism that enables you to register handlers for these events.
eventHandler
can be an instance of the method, or a reference to the method (AddressOf
in Visual Basic).
產品 | 版本 |
---|---|
.NET Framework | 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 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
- RemoveAutomationEventHandler(AutomationEvent, AutomationElement, AutomationEventHandler)
- AddAutomationFocusChangedEventHandler(AutomationFocusChangedEventHandler)
- AddAutomationPropertyChangedEventHandler(AutomationElement, TreeScope, AutomationPropertyChangedEventHandler, AutomationProperty[])
- AddStructureChangedEventHandler(AutomationElement, TreeScope, StructureChangedEventHandler)
- Subscribe to UI Automation Events
- UI Automation Events Overview