C#ResultMonitor类,在TextBox组件显示操作接口
C#ResultMonitor类,在TextBox组件显示操作接口
扫一扫加微信
C# Code:
/// <summary>
/// C#ResultMonitor类,在TextBox组件显示操作接口
/// </summary>
public class ResultMonitor
{
TextBox _txtResult;
public ResultMonitor(TextBox txt)
{
_txtResult = txt;
this.Clear();
}
public void Add(string msg)
{
_txtResult.Text = _txtResult.Text + "\r\n" + msg;
_txtResult.SelectionStart = _txtResult.Text.Length;
_txtResult.SelectionLength = 0;
_txtResult.ScrollToCaret();
}
public void Clear()
{
_txtResult.Text = "准备就绪.";
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// <summary>
/// C#ResultMonitor类,在TextBox组件显示操作接口
/// </summary>
public class ResultMonitor
{
TextBox _txtResult;
public ResultMonitor(TextBox txt)
{
_txtResult = txt;
this.Clear();
}
public void Add(string msg)
{
_txtResult.Text = _txtResult.Text + "\r\n" + msg;
_txtResult.SelectionStart = _txtResult.Text.Length;
_txtResult.SelectionLength = 0;
_txtResult.ScrollToCaret();
}
public void Clear()
{
_txtResult.Text = "准备就绪.";
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
C# Code:
ResultMonitor monitor = new ResultMonitor(txtResult);
monitor.Add("ResultMonitor类");
monitor.Add("在TextBox组件显示操作接口");
monitor.Add("操作完成.");
monitor.Add("www.csframework.com");
//来源:C/S框架网 | www.csframework.com | QQ:23404761
monitor.Add("ResultMonitor类");
monitor.Add("在TextBox组件显示操作接口");
monitor.Add("操作完成.");
monitor.Add("www.csframework.com");
//来源:C/S框架网 | www.csframework.com | QQ:23404761
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网