111,093
社区成员




namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private delegate void MyDelegate();
int num = 0;
Thread t1;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
t1 = new Thread(SetText);
t1.IsBackground = true;
t1.Start();
}
private void SetText()
{
MyDelegate d1 = StartDelegate;
while (true)
{
textBox1.Invoke(d1);
}
}
void StartDelegate()
{
//textBox1.Text = num++.ToString();
Thread.Sleep(10000);
}
private void button2_Click(object sender, EventArgs e)
{
t1.Suspend();
}
}
}