AutomationFocusChangedEventHandler 委托

定义

表示一个方法,该方法由 UI 自动化客户端应用程序实现以处理焦点更改时由 UI 自动化提供程序引发的事件。

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

参数

sender
Object

引发事件的对象。

e
AutomationFocusChangedEventArgs

有关事件的信息。

示例

以下示例实现委托来处理焦点更改的事件。

private void OnFocusChanged(object src, AutomationFocusChangedEventArgs e)
{
    AutomationElement elementFocused = src as AutomationElement;
    // TODO: Do something in response to the focus change.
}
Private Sub OnFocusChanged(ByVal src As Object, ByVal e As AutomationFocusChangedEventArgs)
    Dim elementFocused As AutomationElement = DirectCast(src, AutomationElement)
    ' TODO: Do something in response to the focus change.
End Sub

注解

AutomationFocusChangedEventHandler使用委托定义客户端调用的方法来处理UI 自动化焦点更改事件。

表示 AutomationElementsender 可能没有任何缓存的属性或模式,具体取决于应用程序是否在活动期间 CacheRequest 订阅了此事件。

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。

适用于

另请参阅