private Point GetAdjustedPointFromDocument(ITextRange range)
        {
            ScrollViewer scrollViewer = CodeEditor.FindDescendant <ScrollViewer>();

            range.GetPoint(HorizontalCharacterAlignment.Left, VerticalCharacterAlignment.Bottom, PointOptions.ClientCoordinates, out Point textRangePoint);
            return(new Point(textRangePoint.X - scrollViewer.HorizontalOffset, textRangePoint.Y - scrollViewer.VerticalOffset));
        }
Example #2
0
        private Point GetRangePoint(int flags)
        {
            int x, y;

            _range.GetPoint(flags, out x, out y);
            return(_document.Control.PointToClient(new Point(x, y)));
        }
Example #3
0
 // this wrapper around ITextRange.GetPoint returns true if GetPoint returned S_OK, false if GetPoint returned S_FALSE,
 // or throws an exception for an error hresult.
 internal static bool RangeGetPoint(ITextRange range, TomGetPoint type, out int x, out int y)
 {
     int hr = range.GetPoint(type, out x, out y);
     if (hr < 0)
     {
         Marshal.ThrowExceptionForHR(hr);
     }
     return hr == 0;
 }