public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Control.CheckForIllegalCrossThreadCalls = false;
//夸线程操作
}
private void button1_Click(object sender, EventArgs e)
{
Thread th = new Thread(test);
th.Start();
}
object o = new object();
public void test()
{
for (int i = 0; i < 1000; i++)
{
lock(new object())
{
int n = int.Parse(label1.Text);
n++;
label1.Text = n.ToString();
}
}
}
}