先設置最大值和步長:
this.pBUpload.Properties.Maximum = int.Parse(fileLength.ToString());
this.pBUpload.Properties.Step = buffer.Length;
再在循環中加入以下代碼:
//處理當前消息隊列中的所有windows消息
Application.DoEvents();
this.pBUpload.PerformStep();
設置顯示進度的百分比:
ShowTitle 設置爲True;