TextBox 保持固定长度,添加新行滚动到最后,跨线程。

txtBxMsg.BeginInvoke((MethodInvoker)delegate
{
if (txtBxMsg.Text.Length > 10000)
txtBxMsg.Text = txtBxMsg.Text.Substring(txtBxMsg.Text.Length - 10000);
txtBxMsg.AppendText( "\r\n" + AMsg);
txtBxMsg.ScrollToCaret();
});

posted @ 2019-11-06 22:10  percent10  阅读(134)  评论(0编辑  收藏  举报