0

私はこれを使用して にテキストを書き戻しtextbox1、クロススレッド操作を回避するために正しく機能しますが...そこから1行の出力しか受け取りません。AppendText基本的なテキスト通話ではなく、より多くの通話を行う方法はありますか?

  private void SetText(string text)
    {
        // InvokeRequired required compares the thread ID of the
        // calling thread to the thread ID of the creating thread.
        // If these threads are different, it returns true.
        if (this.textBox1.InvokeRequired)
        {
            SetTextCallback d = new SetTextCallback(SetText);
            this.Invoke(d, new object[] { text });
        }
        else
        {
            this.textBox1.Text = text;
        }
    }
4

1 に答える 1

1
 private void SetText(string text)
 {
    // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
      // If these threads are different, it returns true.
    if (this.textBox1.InvokeRequired)
      {
        SetTextCallback d = new SetTextCallback(SetText);
        this.Invoke(d, new object[] { text });
     }
    else
     {
         //append  text  like  this  
         this.textBox1.Text += text;
     }
}
于 2013-11-19T21:20:32.383 に答える