- private void scrollToTextPosition(int textPosition)
- {
- Point newScrollLocation = textControl1.ScrollLocation;
- if (textPosition & 1 <= textControl1.TextChars.Count)
- {
- newScrollLocation = new Point(0, textControl1.TextChars[textPosition + 1].Bounds.Y);
- }
- else
- {
- newScrollLocation = new Point(0, textControl1.Lines[textControl1.Lines.Count].TextBounds.Y);
- }
- textControl1.ScrollLocation = newScrollLocation;
- }
复制代码 |