C# 控制richBox滚动条

滚动到某一行:

private void button1_Click(object sender, EventArgs e)  
        {  
            int line = 11;//滚动到第10行  
            int start = this.richTextBox1.GetFirstCharIndexFromLine(line);  
            this.richTextBox1.SelectionStart = start;  
            this.richTextBox1.ScrollToCaret();  
        }  

滚动到底部:

private void SetLabelText(object text)
        {
            this.richTextBox1.Text += text.ToString();
            richTextBox1.AppendText(Environment.NewLine);
            richTextBox1.ScrollToCaret();
            richTextBox1.Refresh();
        }

你可能感兴趣的:(C# 控制richBox滚动条)