C ා WinForm program progress bar

Time:2020-10-25

Control bar control: ProgressBar

Can not automatically change according to the process of your program, you need to calculate and adjust the amount of change

 private void progressBar1_Click(object sender, EventArgs e)
        {
                this.progressBar1 . maximum = 100; / / sets the maximum length of the progress bar
                this.progressBar1 . value = 0; / / sets the current value
        }
     

progressBar1.Invoke(new Action(() => { this.progressBar1 . value = 0;})); / / initialization of progress bar

 if (this.progressBar1.Value < 45)
      {
                    progressBar1.Invoke(new Action(() => { this.progressBar1 . value + = 5;})); / / change the value of the progress bar
        }

progressBar1.Invoke(new Action(() => { this.progressBar1 .Value = this.progressBar1 . maximum;})); / / progress bar reaches full value

 

Recommended Today

Design considerations and MySQL database

The following is my personal opinion. I have written it wrong, or I understand it wrong. Please understandIf there is a problem with self built MySQL using the information in this article, please don’t come to meIf you have a better solution, or suggestions, you are welcome to submit the versionTimAutumnWind (please indicate the source […]