AutomationFocusChangedEventHandler 代理人

定義

代表使用者介面自動化用戶端應用程式所實作的方法,這個方法用來處理使用者介面自動化提供者在焦點已變更時所引發的事件。

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使用委派來定義用戶端呼叫的方法,以處理消費者介面自動化焦點變更事件。

sender 表示的 AutomationElement ,可能沒有任何快取的屬性或模式,取決於應用程式是否在作用中時 CacheRequest 訂閱此事件。

擴充方法

GetMethodInfo(Delegate)

取得表示特定委派所代表之方法的物件。

適用於

另請參閱