AutomationElement.ClickablePointProperty 字段

定义

标识可单击点的属性。

public: static initonly System::Windows::Automation::AutomationProperty ^ ClickablePointProperty;
public static readonly System.Windows.Automation.AutomationProperty ClickablePointProperty;
 staticval mutable ClickablePointProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly ClickablePointProperty As AutomationProperty 

字段值

示例

以下示例检索 属性的当前值。

System.Windows.Point clickablePoint = new System.Windows.Point(-1,-1);
object prop = autoElement.GetCurrentPropertyValue(AutomationElement.ClickablePointProperty);
// Do not attempt to cast prop if it is null.
if (prop is System.Windows.Point)
{
    clickablePoint = (System.Windows.Point)prop;
}
Dim clickablePoint As New System.Windows.Point(- 1, - 1)
Dim prop As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ClickablePointProperty)
' Do not attempt to cast prop if it is null.
If TypeOf prop Is System.Windows.Point Then
    clickablePoint = DirectCast(prop, System.Windows.Point)
End If

以下示例检索属性的当前值,但指定如果元素本身未为属性提供值, NotSupported 则返回 而不是默认值。

System.Windows.Point clickablePoint1;
object clickablePointNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.ClickablePointProperty, true);
if (clickablePointNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    clickablePoint1 = (System.Windows.Point)clickablePointNoDefault;
}
Dim clickablePoint1 As System.Windows.Point
Dim clickablePointNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.ClickablePointProperty, True)
If clickablePointNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    clickablePoint1 = DirectCast(clickablePointNoDefault, System.Windows.Point)
End If

注解

此标识符由 UI 自动化客户端应用程序使用。 UI 自动化提供程序应使用 中的 AutomationElementIdentifiers等效标识符。

如果被另一个 AutomationElement 窗口完全遮盖,则无法单击 。

属性的返回值的类型为 Point。 默认值是 null

返回的值以物理屏幕坐标表示。

适用于

另请参阅