滾動(dòng)到某一行:
private void button1_Click(object sender, EventArgs e)
{
int line = 11;//滾動(dòng)到第10行
int start = this.richTextBox1.GetFirstCharIndexFromLine(line);
this.richTextBox1.SelectionStart = start;
this.richTextBox1.ScrollToCaret();
}
滾動(dòng)到底部:
private void SetLabelText(object text)
{
this.richTextBox1.Text += text.ToString();
richTextBox1.AppendText(Environment.NewLine);
richTextBox1.ScrollToCaret();
richTextBox1.Refresh();
}