RangeFromPoint Method
Collapse the table of content
Expand the table of content

TextPattern.RangeFromPoint Method (Point)

 

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

Namespace:   System.Windows.Automation
Assembly:  UIAutomationClient (in UIAutomationClient.dll)

Public Function RangeFromPoint (
	screenLocation As Point
) As TextPatternRange

Parameters

screenLocation
Type: System.Windows.Point

The location in screen coordinates.

Return Value

Type: System.Windows.Automation.Text.TextPatternRange

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

Exception Condition
ArgumentException

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

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.

Private Function GetRangeFromPoint() As TextPatternRange
    Return targetTextPattern.RangeFromPoint( _
    _root.Current.BoundingRectangle.TopLeft)
End Function

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft