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

        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); }

 

posted @ 2017-04-07 15:59  Z_JRV1  阅读(435)  评论(0编辑  收藏  举报