ProgressChanged改变进度条好像不能同步
private void PrintItem_DoWork(object sender, DoWorkEventArgs e)
{
int i = 0;
printlist = new ArrayList();
foreach (string[] pl in addlist)
{
if (pl[6] == "")
{
pl[6] = "该订单打印完成";
}
i++;
printlist.Add(pl);
Thread.Sleep(1000);
this.PrintItem.ReportProgress(i, string.Format("{0}%", i));
}
}
private void PrintItem_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.toolStripProgressBar.Value = e.ProgressPercentage;
this.toolStripLabel.Text = "已完成:" + e.ProgressPercentage / this.toolStripProgressBar.Maximum * 100 + " %";
}
如上面的代码,进度条好像要滞后,并且菜单中this.toolStripLabel.Text不能及时更新,有什么办法?
--------------------编程问答--------------------
--------------------编程问答--------------------
没有人注意这个
补充:.NET技术 , C#