System.Windows.Automation.TextPattern.RangeFromPoint C# (CSharp) Method

RangeFromPoint() public method

public RangeFromPoint ( System.Point screenLocation ) : TextPatternRange
screenLocation System.Point
return System.Windows.Automation.Text.TextPatternRange
        public TextPatternRange RangeFromPoint(Point screenLocation)
        {
            try
            {
                return TextPatternRange.Wrap(this._pattern.RangeFromPoint(Utility.PointManagedToNative(screenLocation)), this);
            }
            catch (System.Runtime.InteropServices.COMException e)
            {
                Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; }
            }
        }

Usage Example

Ejemplo n.º 1
0
        //---------------------------------------------------------------------------
        // Wrapper for TextPattern.RangeFromPoint Method
        //---------------------------------------------------------------------------
        internal void Pattern_RangeFromPoint(TextPattern textPattern, ref TextPatternRange returnedRange, Point screenLocation, Type expectedException, CheckType checkType)
        {
            string call = "TextPattern.RangeFromPoint(" + screenLocation + ")";
            Comment("---Calling " + call);

            try
            {
                returnedRange = textPattern.RangeFromPoint(screenLocation);
            }
            catch (Exception actualException)
            {
                if (Library.IsCriticalException(actualException))
                    throw;

                TestException(expectedException, actualException, call, checkType);
                return;
            }

            if (returnedRange == null)
                throw new ArgumentNullException(call + " should not give a null TextPatternRange");

            TestNoExceptionQuiet(expectedException, call, checkType);
        }