TextPattern.RangeFromPoint(Point) 方法

定义

返回离指定屏幕坐标最近的退化(空)文本范围。

public:
 System::Windows::Automation::Text::TextPatternRange ^ RangeFromPoint(System::Windows::Point screenLocation);
public System.Windows.Automation.Text.TextPatternRange RangeFromPoint(System.Windows.Point screenLocation);
member this.RangeFromPoint : System.Windows.Point -> System.Windows.Automation.Text.TextPatternRange
Public Function RangeFromPoint (screenLocation As Point) As TextPatternRange

参数

screenLocation
Point

屏幕坐标中的位置。

返回

离指定位置最近的退化范围。 Null 从不返回。

例外

给定点位于与文本模式关联的外部 AutomationElement

示例

private TextPatternRange GetRangeFromPoint()
{
    return targetTextPattern.RangeFromPoint(
        _root.Current.BoundingRectangle.TopLeft);
}
Private Function GetRangeFromPoint() As TextPatternRange
    Return targetTextPattern.RangeFromPoint( _
    _root.Current.BoundingRectangle.TopLeft)
End Function

注解

如果屏幕坐标位于图像、超链接、Microsoft Excel电子表格或其他嵌入对象的坐标范围内,将返回包装子对象的文本范围。

由于隐藏文本不会被忽略 RangeFromPoint,因此返回从离给定点最近的可见文本的退化范围。

适用于

另请参阅