public void ScrollTo(int line, int column) { if (_motherTextEditorControl.IsInUpdate) { _scrollToPosOnNextUpdate = new Point(column, line); return; } else { _scrollToPosOnNextUpdate = Point.Empty; } ScrollTo(line); int curCharMin = HScrollBar.Value - HScrollBar.Minimum; int curCharMax = curCharMin + TextArea.VisibleColumnCount; int pos = TextArea.GetVisualColumn(line, column); if (TextArea.VisibleColumnCount < 0) { HScrollBar.Value = 0; } else { if (pos < curCharMin) { HScrollBar.Value = Math.Max(0, pos - _scrollMarginHeight); } else { if (pos > curCharMax) { HScrollBar.Value = Math.Max(0, Math.Min(HScrollBar.Maximum, (pos - TextArea.VisibleColumnCount + _scrollMarginHeight))); } } } }