C#ResultMonitor类,在TextBox组件显示操作接口
作者:C/S框架网|www.cscode.ne  发布日期:2021-03-04 11:35:50
  C#ResultMonitor类,在TextBox组件显示操作接口


贴图图片-result_monitor



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





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




C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务

上一篇 下一篇