Winforms ProgressBar Takes time to Render

前端 未结 7 1641
清歌不尽
清歌不尽 2021-01-15 10:12

I have noticied that when using the PorgressBar. If I set the value to x, the value displayed is not immediately updated, it takes a small amount of time to draw it as the b

7条回答
  •  感情败类
    2021-01-15 11:03

    The problem is that you're in a single threaded program and the thread needs time to update the display.

    Add the line

    Application.DoEvents()
    

    Before closing the UpdateProgress sub.

    And you can get rid of the last two refresh.

提交回复
热议问题