C# scrolling of richtextbox

喜夏-厌秋 提交于 2019-12-11 12:52:36

问题


Is there a method to scroll the richtextbox to the top automatically with codes? Thanks!


回答1:


you mean bottom?

instance.SelectionStart = instance.Text.Length;

or i guess top would be instance.SelectionStart = 0.




回答2:


Set .SelectionStart=0 and then .ScrollToCaret().




回答3:


richTextBox.SelectionStart = richTextBox.Text.Length;
richTextBox.ScrollToCaret();

tRY the above 2 lines of code it worked for me!



来源:https://stackoverflow.com/questions/4373433/c-sharp-scrolling-of-richtextbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!