winform中使用TextBox滚动显示日志信息
代码如下:
private void ShowInfo(string msg) { this.BeginInvoke((Action)(() => { textBox1.AppendText(string.Format("{0} {1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), msg)); textBox1.AppendText(Environment.NewLine); textBox1.ScrollToCaret(); })); }