Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change visual step size of TProgressBar?

I have a form with a TProgressBar set up as follows:

myProgressBar.Step := 1;
myProgressBar.Min := 0;
myProgressBar.Max := 60;
myProgressBar.Position := 0;

A timer with 1000ms interval is started on form start and every timer tick the progress bar is stepped. After 60s the bar is nearly full (see image, with a debug label showing the time elapsed) but there are only ~19.5 blocks in the bar, not my expected 60. This means that you only see a step about every 3s.

TProgressBar with overly chunky steps

Is there anything I can do about this? None of the exposed properties in the designer seem to help. I'd be happy to send the control a message if this solved the problem. For example, I use this code elsewhere to change the colour of a progress bar at runtime:

SendMessage(pbBin1.Handle, PBM_SETBARCOLOR, 0, clLime);
like image 1000
AlainD Avatar asked Dec 01 '25 20:12

AlainD


1 Answers

The progress bar is drawn by the system and you don't get to choose the block size. Instead you could use a smooth progress bar. Set the Smooth property to True.

like image 123
David Heffernan Avatar answered Dec 04 '25 22:12

David Heffernan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!