private void ProgressBarPerformStep(ToolStripProgressBar pb)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (statusStrip1.InvokeRequired)
{
ProgressBarPerformStepCallback d = new ProgressBarPerformStepCallback(ProgressBarPerformStep);
statusStrip1.BeginInvoke(d, new object[] { pb });
}
else
{
if (pb.Value == pb.Maximum)
ProgressBarFillTimes++;
if (ProgressBarFillTimes == 100)
{
pb.Value = pb.Minimum;
ProgressBarFillTimes = 0;
}
pb.PerformStep();
}
}