Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoscrolling in RichTextBox C# WinForms [duplicate]

How can I do that if I append some text the RTB will automatically scroll down?

Now I'm using:

conversationRtb.Rtf = tab.conversationRtb.Rtf;
conversationRtb.SelectionStart = conversationRtb.Text.Length;
conversationRtb.ScrollToCaret();

But it isn't working well. Sometimes it doesn't scroll to end but one line before end.

rtb scroll down bug

Sometimes it makes a big offset.

rtb scroll down bug

I cannot find why. Is there any another way how to scroll down? I've found AutoScrollOffset but no examples how it works.

like image 870
sczdavos Avatar asked Oct 05 '12 15:10

sczdavos


1 Answers

You can adjust HideSelection value to false, the AppendText will trigger the correct scroll.

like image 76
Aghilas Yakoub Avatar answered Oct 13 '22 10:10

Aghilas Yakoub