Progress Button for Windows Forms

.NET newbie here ... I would like to make a button in the form of Windows that displays the progress or the "cooldown" effect. That is, when the button is pressed, it becomes disabled. As an event or timer occurs, the button shows progress graphically. Upon completion of the execution of the schedule is completed, and the button is turned on. Similar effects can be seen in many games.

I would think of using a combination of the built-in Button class and the GDI + DrawPath function, but the complexity does not scale well, and I get a grunt feeling that there should be an easier way.

Any ideas? Thank.

+3
source share
3 answers

, .

:

button += new buttonPaintEvent(buttonPaintEventHandlerMethod);
0

- , - / . , . . , , .

+1

Another simple way is to have two controls, a button and a progress bar, which occupy the same space in the form. When the user presses the button, hide the button and show the progress bar. Update the progress bar until any processing is completed. Then hide the progress bar and press the button again.

+1
source

Source: https://habr.com/ru/post/1698190/


All Articles