public void tick() { if (tickCount != EstimatedCompletionTime) { // will tick every 1.0 seconds and update "progress" if (tickCount < EstimatedCompletionTime) { double ticks = (double)tickCount; double estCompletion = (double)EstimatedCompletionTime; double thisWidth = (double)this.Size.Width; double percentComplete = ticks / estCompletion; // calc size of progress rectablge based on % complete int rectWidth = (int)(thisWidth * percentComplete); rectProgress.Size = new Size(rectWidth, this.Size.Height); tickCount++; //myParentProgressBar.Refresh(); } else { EstimatedProgressTimer.Stop(); rectProgress.Size = this.Size; //myParentProgressBar.Refresh(); } } }
public void Finished() { EstimatedProgressTimer.Stop(); tickCount = EstimatedCompletionTime; rectProgress.Visible = true; rectProgress.Size = this.Size; myParentProgressBar.Refresh(); //Application.DoEvents(); }
public void pause() { EstimatedProgressTimer.Stop(); }