窗口中有两个控件,一个richTextBox名字为rtxt_main,另外一个为一个按钮(Button)名字为button01,程序启动后点击按钮将启动一个线程,在线程中使用委托技术更新richTextBox的文字,关键代码如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;
using System.Threading;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Sockets;
using System.Net;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public int port = 8192;
public Form1()
{
InitializeComponent();
}
public delegate void delegateHandler(String str); //定义一个委托
{
public partial class Form1 : Form
{
public int port = 8192;
public Form1()
{
InitializeComponent();
}
public delegate void delegateHandler(String str); //定义一个委托
private void Form1