Επεξεργασία

Κοινή χρήση μέσω


TextPattern.RangeFromPoint(Point) Method

Definition

Returns the degenerate (empty) text range nearest to the specified screen coordinates.

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

Parameters

screenLocation
Point

The location in screen coordinates.

Returns

A degenerate range nearest the specified location. Null is never returned.

Exceptions

A given point is outside the AutomationElement associated with the text pattern.

Examples

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

Remarks

A text range that wraps a child object is returned if the screen coordinates are within the coordinates of an image, hyperlink, Microsoft Excel spreadsheet, or other embedded object.

Because hidden text is not ignored by RangeFromPoint, a degenerate range from the visible text closest to the given point is returned.

Applies to

See also