Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     //线程访问控件(不安全的方式)
     //TextBox.CheckForIllegalCrossThreadCalls = false;
     setTex = new DelegateSetText(SetText);
 }
Exemplo n.º 2
0
 private void UpdateUps(int ups)
 {
     if (InvokeRequired)
     {
         var d = new DelegateSetText(UpdateUps);
         Invoke(d, ups);
     }
     else
     {
         Text = $"Crystalshire - Authentication @ {ups} Ups";
     }
 }
Exemplo n.º 3
0
 public Form1()
 {
     InitializeComponent();
     textBox1.ScrollBars = ScrollBars.Vertical;
     SetTextBox1Text     = new DelegateSetText((s) => { textBox1.Text = s; });
 }
Exemplo n.º 4
0
 private void SetText(string text)
 {
     if (txtConsole.InvokeRequired)
     {
         DelegateSetText  method = new DelegateSetText(SetText);
         this.Invoke(method, text);
     }
     else
     {
         txtConsole.Text += text+Environment.NewLine;
     }
 }