如何使自动滚动多行TextBox中的WinForms? [英] How to make autoscroll multiline TextBox in WinForms?

查看:217
本文介绍了如何使自动滚动多行TextBox中的WinForms?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/898307/how-do-i-automatically-scroll-to-the-bottom-of-a-multiline-text-box">How我自动滚动多行文本框的底部?

我用的是多行文本框来输出新线的一些信息,因为它从到达一个的BackgroundWorker

I use a multiline TextBox to output some information in new lines as it arrives from a BackgroundWorker.

我可以把它给每个新线到达时滚动至最底部?

Can I make it to scroll to the very bottom each time a new line arrives?

在默认情况下它似乎做的正好相反 - 每一个新行到达时,它滚动到第一行的文本属性更改

By default it seems to do just the opposite - it scrolls to the very first line each time a new line arrives and the Text property is changed.

推荐答案

文本属性:

多= TRUE
滚动条=两个

Multiline = True
ScrollBars = Both

要自动滚屏上的框TextChanged 事件:

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

这篇关于如何使自动滚动多行TextBox中的WinForms?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆