AutomationElement.AutomationElementInformation 結構

定義

包含 CachedCurrent 屬性所使用的屬性存取子。

public: value class AutomationElement::AutomationElementInformation
public struct AutomationElement.AutomationElementInformation
type AutomationElement.AutomationElementInformation = struct
Public Structure AutomationElement.AutomationElementInformation
繼承
AutomationElement.AutomationElementInformation

範例

下列範例示範如何 Name 從這個 結構擷取 屬性。

/// <summary>
/// Handles ElementSelected events by showing a message.
/// </summary>
/// <param name="src">Object that raised the event; in this case, a list item.</param>
/// <param name="e">Event arguments.</param>
private void OnSelect(object src, AutomationEventArgs e)
{
    // Get the name of the item, which is equivalent to its text.
    AutomationElement element = src as AutomationElement;
    if (element != null)
    {
        Console.WriteLine(element.Current.Name + " was selected.");
    }
}
''' <summary>
''' Handles ElementSelected events by showing a message.
''' </summary>
''' <param name="src">Object that raised the event; in this case, a list item.</param>
''' <param name="e">Event arguments.</param>
Private Sub OnSelect(ByVal src As Object, ByVal e As AutomationEventArgs)
    ' Get the name of the item, which is equivalent to its text.
    Dim element As AutomationElement = DirectCast(src, AutomationElement)
    If (element IsNot Nothing) Then
        Console.WriteLine(element.Current.Name + " was selected.")
    End If

End Sub

備註

屬性可以直接從 CachedCurrent 存取;您不需要擷取 AutomationElement.AutomationElementInformation 結構本身。

您也可以使用 和 GetCachedPropertyValue ,從 AutomationElementGetCurrentPropertyValue 取這個結構中的屬性。 例如,屬性 AutomationElement.AutomationElementInformation.AcceleratorKey 是由 AutomationElement.AcceleratorKeyProperty 欄位識別。 如需個別屬性的詳細資訊,請參閱這些識別碼的參考頁面;請參閱每個參考主題一節中的連結。

屬性

AcceleratorKey

取得的字串包含項目的快速鍵組合。

AccessKey

取得的字串包含項目的便捷鍵字元。

AutomationId

取得字串,其中包含專案的 UI 自動化識別碼 (識別碼) 。

BoundingRectangle

取得完全圍住項目的矩形座標。

ClassName

取得的字串包含控制項開發人員指定之項目的類別名稱。

ControlType

取得項目的 ControlType

FrameworkId

取得基礎 UI 架構的名稱。

HasKeyboardFocus

取得的值指出項目是否有鍵盤焦點。

HelpText

取得與項目相關的說明文字。

IsContentElement

取得的值指出項目是否為內容項目。

IsControlElement

取得的值指出是否將項目視為控制項。

IsEnabled

取得值,這個值表示是否已啟用使用者介面 (UI 所參考) 專案的使用者介面。

IsKeyboardFocusable

取得值,這個值表示使用者介面自動化專案是否可以接受鍵盤焦點。

IsOffscreen

取得值,這個值表示是否在螢幕上顯示使用者介面自動化專案。

IsPassword

取得值,這個值表示使用者介面自動化專案是否包含受保護的內容。

IsRequiredForForm

取得值,這個值表示是否需要在表單上填寫使用者介面自動化專案。

ItemStatus

取得的描述會說明項目 (element) 內某項目 (item) 的狀態。

ItemType

取得說明項目型別的描述。

LabeledBy

取得的項目包含此項目的文字標籤。

LocalizedControlType

取得控制項型別的描述。

Name

取得項目的名稱。

NativeWindowHandle

取得項目之視窗的控制代碼。

Orientation

取得控制項的方向。

ProcessId

取得這個專案 (識別碼) 的進程識別碼。

適用於

另請參閱