AutomationElement.AutomationElementInformation 结构

定义

包含由 CachedCurrent 属性使用的属性访问器。Contains the property accessors used by the Cached or Current properties.

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

示例

下面的示例演示如何从此结构检索 Name 属性。The following example shows how the Name property is retrieved from this structure.

/// <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 结构本身。The properties can be accessed directly from Cached and Current; you do not need to retrieve the AutomationElement.AutomationElementInformation structure itself.

此结构中的属性也可以通过使用 GetCurrentPropertyValue,并使用 AutomationElement中的相应标识符 GetCachedPropertyValue来检索。The properties in this structure can also be retrieved by using GetCurrentPropertyValue and GetCachedPropertyValue, using the corresponding identifiers from AutomationElement. 例如,AutomationElement.AutomationElementInformation.AcceleratorKey 属性由 AutomationElement.AcceleratorKeyProperty 字段标识。For example, The AutomationElement.AutomationElementInformation.AcceleratorKey property is identified by the AutomationElement.AcceleratorKeyProperty field. 有关各个属性的详细信息可在这些标识符的参考页上找到;请参阅每个参考主题的 "备注" 部分中的链接。More information about the individual properties is available on the reference pages for those identifiers; see the link in the Remarks section of each reference topic.

属性

AcceleratorKey

获取一个包含元素快捷键组合的字符串。Gets a string containing the accelerator key combinations for the element.

AccessKey

获取一个包含元素的访问键字符的字符串。Gets a string containing the access key character for the element.

AutomationId

获取一个字符串,其中包含元素的 UI 自动化UI Automation 标识符 (ID)identifier (ID)Gets a string containing the UI 自动化UI Automation 标识符 (ID)identifier (ID) for the element.

BoundingRectangle

获取完全包围元素的矩形的坐标。Gets the coordinates of the rectangle that completely encloses the element.

ClassName

获取一个字符串,其中包含由控件开发人员分配的元素的类名称。Gets a string containing the class name of the element as assigned by the control developer.

ControlType

获取元素的 ControlTypeGets the ControlType of the element.

FrameworkId

获取基础 UI 框架的名称。Gets the name of the underlying UI framework.

HasKeyboardFocus

获取一个值,该值指示此元素是否具有键盘焦点。Gets a value that indicates whether the element has keyboard focus.

HelpText

获取与元素关联的帮助文本。Gets the help text associated with the element.

IsContentElement

获取一个值,该值指定元素是否为内容元素。Gets a value that specifies whether the element is a content element.

IsControlElement

获取一个值,该值指示元素是否以控件的形式查看。Gets a value that indicates whether the element is viewed as a control.

IsEnabled

获取一个值,该值指示是否已启用由 用户界面 (UI)user interface (UI)元素引用的 UI 自动化UI Automation 项。Gets a value that indicates whether the 用户界面 (UI)user interface (UI) item referenced by the UI 自动化UI Automation element is enabled.

IsKeyboardFocusable

获取一个值,该值指示 UI 自动化UI Automation元素是否可接受键盘焦点。Gets a value that indicates whether the UI 自动化UI Automation element can accept keyboard focus.

IsOffscreen

获取一个值,该值指示 UI 自动化UI Automation元素在屏幕上是否可见。Gets a value that indicates whether the UI 自动化UI Automation element is visible on the screen.

IsPassword

获取一个值,该值指示 UI 自动化UI Automation元素是否包含受保护的内容。Gets a value that indicates whether the UI 自动化UI Automation element contains protected content.

IsRequiredForForm

获取一个值,该值指示是否需要在窗体上填充 UI 自动化UI Automation元素。Gets a value that indicates whether the UI 自动化UI Automation element is required to be filled out on a form.

ItemStatus

获取元素内某一项的状态说明。Gets a description of the status of an item within an element.

ItemType

获取一个项的类型说明。Gets a description of the type of an item.

LabeledBy

获取包含此元素的文本标签的元素。Gets the element that contains the text label for this element.

LocalizedControlType

获取控件类型的说明。Gets a description of the control type.

Name

获取元素的名称。Gets the name of the element.

NativeWindowHandle

获取元素窗口的句柄。Gets the handle of the element's window.

Orientation

获取控件的方向。Gets the orientation of the control.

ProcessId

获取此元素的进程 标识符 (ID)identifier (ID)Gets the process 标识符 (ID)identifier (ID) of this element.

适用于

另请参阅