Discussion of article "DoEasy. Controls (Part 27): Working on ProgressBar WinForms object"

 

New article DoEasy. Controls (Part 27): Working on ProgressBar WinForms object has been published:

In this article, I will continue the development of the ProgressBar control. In particular, I will create the functionality for managing the progress bar and visual effects.

Compile and launch the EA on the chart:


In the first loop, we see how the width of the ProgressBar object increases, and the width of the progress bar also increases proportionally. At the same time, the Value is initially set to 50, and it remains so, since the width of the progress bar is set in relative values.

In the second loop, we call the PerformStep method each time, which at each step increments the (relative) Value by the value of the increment step. Although there are 350 increments, we can see that the progress bar is growing by more than 1 pixel at a time. This is due to the fact that all values are relative and are calculated as a percentage of the width of the ProgressBar. This is correct since it is impossible to increment one pixel at each step. If the ProgressBar width is 100 pixels and the number of steps is 1000, then we have 10 increment steps per pixel. They are skipped when calculating relative values.

When the progress bar increment loop completes, we see a glare run through it every two seconds. This is enough for demonstration. However, this is insufficient for normal appearance. First, the glare should run along the moving progress bar, and not along the completed one, and second, the "effect" has turned out to be too simple. I will gradually improve all this.

Author: Artyom Trishkin

Reason: