outputScreen.AppendText(text);
int length;
length = outputScreen.TextLength;
if (length > 10000)
{
outputScreen.Text = outputScreen.Text.Substring(length - 10000));
}当 总长度>10000后 每次截取最后10000个数据的时候, 滚动条总会跳到最上,只能手动设到最后 有没有办法给Text赋值的时候光标直接是在最后的?或者有没有别的删掉textBox前面几行的办法?
int length;
length = outputScreen.TextLength;
if (length > 10000)
{
outputScreen.Text = outputScreen.Text.Substring(length - 10000));
}当 总长度>10000后 每次截取最后10000个数据的时候, 滚动条总会跳到最上,只能手动设到最后 有没有办法给Text赋值的时候光标直接是在最后的?或者有没有别的删掉textBox前面几行的办法?
outputScreen.ScrollToCaret();欢迎加入,IT技术联盟:34683253
private void tb_Import_TextChanged(object sender, EventArgs e)
{
ChanageTextBox(this.tb_Import);
}
private void ChanageTextBox(TextBox tb)
{
tb.SelectionStart = tb.Text.Length;
tb.SelectionLength = 0;
tb.ScrollToCaret();
}
outputScreen.Focus();
outputScreen.SelectionStart = outputScreen.Text.Length;光标在最后但是滚动条还是在最上面
outputScreen.ScrollToCaret();原来还有这个
这样改的话,没达到目的呀, 我是想当数据超过10000后, 删掉开始的几笔数据, 显示在textbox上面的保持10000