日期:2014-05-18 浏览次数:20858 次
//记录当前区域第一行的行号(从0开始的) Point pos = new Point(0, 0); int firstIndex = richTextBox1.GetCharIndexFromPosition(pos); int firstLine = richTextBox1.GetLineFromCharIndex(firstIndex); //根据保存的行号确定滚动条 int line = 11;//滚动到第11行 (firstLine+1) int start = this.richTextBox1.GetFirstCharIndexFromLine(line); this.richTextBox1.SelectionStart = start; this.richTextBox1.ScrollToCaret();