简体   繁体   中英

Scroll richtextbox in c#.net

I'm looking for C#.net code to scroll a richtextbox programmatically, I have searched about it but I found some examples of VB.Net but don't know how to use them. any help would be highly appreciated. Thanks in Advance :)

If I properly understand, you want to scroll richtextbox to the bottom after new lines were added to this control. Just add this code to method that runs each time you add some new data:

private void AddText(string text)
{
    richTextBox1.AppendText(text + Environment.NewLine);
    richTextBox1.SelectionStart = richTextBox1.Text.Length;
    richTextBox1.ScrollToCaret();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM