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では無視されないため、指定されたポイントに最も近い表示テキストから縮退範囲が返されます。

適用対象

こちらもご覧ください