This topic has not yet been rated - Rate this topic

TextPattern.RangeFromPoint Method

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

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

public TextPatternRange RangeFromPoint (
	Point screenLocation
)
public TextPatternRange RangeFromPoint (
	Point screenLocation
)
public function RangeFromPoint (
	screenLocation : Point
) : TextPatternRange
Not applicable.

Parameters

screenLocation

The location in screen coordinates.

Return Value

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

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 TextPatternRange GetRangeFromPoint()
{
    return targetTextPattern.RangeFromPoint(
        _root.Current.BoundingRectangle.TopLeft);
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.