public TextPatternRange RangeFromPoint(Point screenLocation, bool log) { if (log) { procedureLogger.Action(string.Format("Get the range from point of {0}.", this.NameAndType)); } TextPattern tp = (TextPattern)element.GetCurrentPattern(TextPattern.Pattern); return((TextPatternRange)tp.RangeFromPoint(screenLocation)); }
/// <summary> /// Returns the degenerate (empty) text range nearest to the specified screen coordinates /// </summary> /// <param name="control">The UI Automation element</param> /// <param name="screenLocation">The location in screen coordinates</param> /// <returns> /// A degenerate range nearest the specified location /// </returns> internal static TextPatternRange GetRangeFromPoint(AutomationElement control, Point screenLocation) { TextPattern pat = (TextPattern)CommonUIAPatternHelpers.CheckPatternSupport(TextPattern.Pattern, control); return(pat.RangeFromPoint(screenLocation)); }