在RichTextBox C#WinForms中自动滚动

时间:2012-10-05 15:20:04

标签: c# winforms scroll richtextbox

如果我附加RTB会自动向下滚动一些文字,我怎么能这样做?

现在我正在使用:

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

但它运作不佳。有时它不会滚动到结束,而是在结束前滚动一行。

rtb scroll down bug

有时会产生很大的偏差。

rtb scroll down bug

我找不到原因。有没有其他方法可以向下滚动?我找到了AutoScrollOffset,但没有示例如何运作。

1 个答案:

答案 0 :(得分:8)

您可以调整HideSelection value to false,AppendText将触发正确的滚动。