110,533
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
ThreadPool.QueueUserWorkItem((object o) =>
{
for (int i = 1; i <= 100; i++)
{
this.label1.Invoke(new Action(() => this.label1.Text = i + "%"));
this.progressBar1.Invoke(new Action(() => this.progressBar1.Value = i));
}
});
ThreadPool.QueueUserWorkItem((object o) =>
{
for (int i = 1; i <= 100; i++)
{
this.label2.Invoke(new Action(() => this.label2.Text = i + "%"));
this.progressBar2.Invoke(new Action(() => this.progressBar2.Value = i));
}
});
}