AutomationFocusChangedEventHandler 委托

定义

表示一个方法,该方法由 UI 自动化客户端应用程序实现以处理焦点更改时由 UI 自动化提供程序引发的事件。Represents the method implemented by the UI Automation client application to handle the event raised by a UI Automation provider when the focus has changed.

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

引发事件的对象。The object that raised the event.

e
AutomationFocusChangedEventArgs

有关事件的信息。Information about the event.

继承
AutomationFocusChangedEventHandler

示例

下面的示例实现一个委托以处理焦点更改事件。The following example implements a delegate to handle focus-changed events.

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

注解

使用委托来定义由客户端调用的方法, 以处理UI 自动化UI Automation焦点更改事件。 AutomationFocusChangedEventHandlerUse an AutomationFocusChangedEventHandler delegate to define the method that is called by a client to handle UI 自动化UI Automation focus-changed events.

AutomationElement CacheRequest表示的可能没有任何缓存的属性或模式,具体取决于应用程序是否在处于活动状态时订阅sender了此事件。The AutomationElement represented by sender might not have any cached properties or patterns, depending on whether the application subscribed to this event while a CacheRequest was active.

扩展方法

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

适用于

另请参阅