設定屬性和方法
private void button2_Click(object sender, EventArgs e)
{
timer.Stop();
Thread thread = new Thread(() =>
{
//this.label1.Text = i.ToString();
if (this.button1.InvokeRequired)
{
this.button1.Invoke(new Action(() => this.button1.Enabled = true));
}
Thread.Sleep(300);
});
thread.IsBackground = true;
thread.Start();
}
private void button3_Click(object sender, EventArgs e)
{
Thread thread = new Thread(() =>
{
if (this.richTextBox1.InvokeRequired)
{
this.richTextBox1.Invoke(new Action(() => this.richTextBox1.Clear()));
}
Thread.Sleep(300);
});
thread.IsBackground = true;
thread.Start();
}