Share via


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 隱藏文字,因此會傳回從最接近指定點的可見文字變質範圍。

適用於

另請參閱