在C#多行文本框上实现跟踪 [英] Implementing follow-tail on C# multiline textbox

查看:118
本文介绍了在C#多行文本框上实现跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



在多行文本框中,我附加文字,因此每次附加时滚动到底部。我想在该多行文本上实现跟尾选项(同时在文本框上添加文本滚动)。请给我任何评论...



我试着把文字框的下边缘的行数和设置滚动到那个,但我不能'这样做。



提前谢谢:)

解决方案

按照尾巴我把它带到意味着你想要连续地将文本附加到文本框的末尾并让文本框自动滚动以便新文本可见。



你已经设置了文本框到多行,我建议您添加垂直滚动条如果还没有。



以下代码将移动到文本框的底部一次添加一行



<击> <预LANG = VB> TextBox1.Text + = TweetText + System.Environment.NewLine
textBox1的。 SelectionStart = textBox1.Text.Length
textBox1.ScrollToCaret()





编辑 - 我想试试再次在C#!!!

 textBox1.Text + =( TweetText)+ System.Environment.NewLine; 
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();





其中TweetText是一个字符串


Hi all,

On a multi-line text box I'm appending text, so its scroll to the bottom on each append. I want to implement follow-tail option (while appending text scroll over the text box) on that multi-line text. Any comments please...

I try to get the number of line up to the bottom edge of the text box and set the scroll to that, but I couldn't do that.

Thanks in advance :)

解决方案

By follow-tail I take it to mean that you want to continuously append text to the end of the textbox and have the textbox automatically scroll so that the new text is visible.

You've already set the text box to multiline, and I advise that you add vertical scrollbar if you haven't already.

The following code will move you to the bottom of the text box each time you add a line

TextBox1.Text += TweetText + System.Environment.NewLine
textBox1.SelectionStart = textBox1.Text.Length
textBox1.ScrollToCaret()



EDIT - I'll try that again in C# !!!

textBox1.Text += (TweetText) + System.Environment.NewLine;
textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();



Where TweetText is a string


这篇关于在C#多行文本框上实现跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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