private RectangleF getDocumentArea(Graphics g, RectangleF typingArea, SizeF cellSize) { RectangleF unlimitedHeightArea = getUnlimitedHeightArea(typingArea); RectangleF cursorArea = getCursorCharArea(g, unlimitedHeightArea); Point cursorColumnRow = getColumnRow(cursorArea.Location, unlimitedHeightArea.Location, cellSize); oldCursorPositionChangedEventArgs = Util.RaiseIfEventArgsChanged( OnCursorPositionChanged, new CursorPositionChangedEventArgs(cursorColumnRow.Y + 1, cursorColumnRow.X + 1), oldCursorPositionChangedEventArgs); int currentLineColumns = ImportedText.LineLength(TypedText.Length); Size documentColumnsRows = new Size(ImportedText.LongestLineLength, getDocumentRows(g, unlimitedHeightArea, cellSize)); Size visibleColumnsRows = getVisibleColumnsRows(typingArea.Size, cellSize); float hOffset = cellSize.Width * calcColumnOffset(cursorColumnRow.X, visibleColumnsRows.Width, documentColumnsRows.Width, currentLineColumns), vOffset = cellSize.Height * calcRowOffset(cursorColumnRow.Y, visibleColumnsRows.Height, documentColumnsRows.Height); return(new RectangleF(typingArea.X + hOffset, typingArea.Y + vOffset, typingArea.Width, typingArea.Height - vOffset)); }