关于修改TextBox中的文本(winform)

mac2022-06-30  33

Action<string, TextBox> actionAddTxtDelegate = (x, y) => { y.AppendText(x.ToString() + "\r\n"); y.ScrollToCaret(); }; Action<string, TextBox> actionUpdateTxtDelegate = (x, y) => { string[] lines = y.Lines; if (lines.Length > 0) { lines[lines.Length - 2] = x; } y.Lines = lines; y.ScrollToCaret(); }; public void UpdateTxt(string txt) { this.textBox1.BeginInvoke(actionUpdateTxtDelegate,txt,this.textBox1); } public void AddTxt(string txt) { this.textBox1.BeginInvoke(actionAddTxtDelegate ,txt,this.textBox1); }

 

转载于:https://www.cnblogs.com/JenReiChau/p/6678553.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)