C#多线程使用进度条
时间:2011-04-24 来源:seoxs
//声明一个委托
public delegate void UpdateBar(int iBar);
//委托使用进度条
void UpdateMyBar(int iMyBar)
{//www.elivn.com
if (this.progressBar1.Value != this.progressBar1.Maximum)
{
if (this.progressBar1.InvokeRequired)
{
UpdateBar pb = new UpdateBar(UpdateMyBar);
IAsyncResult pbaResult = this.progressBar1.BeginInvoke(pb, new object[] { iMyBar});
try { pb.EndInvoke(pbaResult); }
catch { }
}
else { this.progressBar1.Value++; }
}
}
相关阅读 更多 +