1.委托

 1 #region 委托
 2         /// <summary>
 3         /// 输出委托
 4         /// </summary>
 5         /// <param name="msg"></param>
 6         private delegate void OutputDelegate(string msg);
 7 
 8         /// <summary>
 9         /// 清空委托
10         /// </summary>
11         private delegate void ClearDelegate();
12 
13         /// <summary>
14         /// 文本框输出委托
15         /// </summary>
16         /// <param name="msg"></param>
17         private void TextBoxOutput(string msg)
18         {   
19             if (ConfigCon.IsVisble==false)
20             {
21                 this.textBox1.Dispatcher.Invoke(new OutputDelegate(OutputAction), msg);
22 
23                 this.textBox1.Dispatcher.Invoke(new ClearDelegate(ClearAction));
24                
25             }
26           
27         }
28 
29         /// <summary>
30         /// 文本框输出内容
31         /// </summary>
32         /// <param name="msg"></param>
33         private void OutputAction(string msg)
34         {
35             this.textBox1.AppendText(msg + "\n");
36            // this.textBox1.AppendText("\n");
37             this.textBox1.ScrollToEnd();
38         }
39 
40 
41         /// <summary>
42         /// 文本框清空
43         /// </summary>
44         private void ClearAction()
45         {
46 
47             if (this.textBox1.LineCount > 10000 * 1)
48             {                
49                 this.textBox1.Clear();    
50             }
51             
52                 
53         }
54 
55         #endregion
View Code

相关文章:

  • 2021-12-31
  • 2021-05-29
  • 2021-06-25
  • 2021-08-11
  • 2021-06-14
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-17
  • 2021-05-21
  • 2021-04-27
  • 2021-09-08
  • 2018-12-21
  • 2021-07-15
相关资源
相似解决方案