संपादित करें

इसके माध्यम से साझा किया गया


AutomationElement.AutomationElementInformation Struct

Definition

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
Inheritance
AutomationElement.AutomationElementInformation

Examples

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

Remarks

The properties can be accessed directly from Cached and Current; you do not need to retrieve the AutomationElement.AutomationElementInformation structure itself.

The properties in this structure can also be retrieved by using GetCurrentPropertyValue and GetCachedPropertyValue, using the corresponding identifiers from AutomationElement. 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.

Properties

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

Gets a string containing the UI Automation 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

Gets the ControlType of the element.

FrameworkId

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

Gets a value that indicates whether the user interface (UI) item referenced by the UI Automation element is enabled.

IsKeyboardFocusable

Gets a value that indicates whether the UI Automation element can accept keyboard focus.

IsOffscreen

Gets a value that indicates whether the UI Automation element is visible on the screen.

IsPassword

Gets a value that indicates whether the UI Automation element contains protected content.

IsRequiredForForm

Gets a value that indicates whether the 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

Gets the process identifier (ID) of this element.

Applies to

See also