C#多线程使用进度条
生活随笔
收集整理的這篇文章主要介紹了
C#多线程使用进度条
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
//聲明一個(gè)委托
??????? public delegate void UpdateBar(int iBar);
??????? //委托使用進(jìn)度條
??????? 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++; }
??????????? }
??????? }
??????? public delegate void UpdateBar(int iBar);
??????? //委托使用進(jìn)度條
??????? 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++; }
??????????? }
??????? }
轉(zhuǎn)載于:https://www.cnblogs.com/seoxs/archive/2011/04/24/2026158.html
總結(jié)
以上是生活随笔為你收集整理的C#多线程使用进度条的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Guava ImmutableColle
- 下一篇: C# 类构造函数赋值里属性与字段赋值注意