Jump to content
Jud

Show percentage in VCL TProgressBar

Recommended Posts

If I remember correctly, VCL ProgressBars used to show the percentage, in numerals.  I'm trying to add one to a Delphi 12.1 project, and it isn't showing the percentage.  I looked at the properties but I didn't see any that seemed like it would turn on the display of the percentage.

 

Is there a way to show percentage on a TProgressBar in Delphi 12.1 VCL?

Share this post


Link to post

TProgressBar is just wrapper around the standard Windows progress bar control so its features and behavior is dictated by that control.

 

It's extremely easy to make a custom progress bar that does what you need with a TPaintBox; It's just two FillRect and two DrawText.

Share this post


Link to post

I thought it used to show the percentage.  It would probably easiest to just put a TLabel above it to tell the percentage.

Share this post


Link to post

TProgressBar (and by extension, the underlying Win32 control) has never had an option to display text. That would require subclassing the ProgressBar to augment its drawing manually.

Share this post


Link to post

Thanks, just my faulty memory from some years ago.  I just stuck a label above it - that is what I must have done way back when.

Share this post


Link to post
7 hours ago, Jud said:

Thanks, just my faulty memory from some years ago.  I just stuck a label above it - that is what I must have done way back when.

Perhaps you remember TGauge, one of the sample components that came with early Delphi versions, before Windows introduced the progressbar common control.

  • Like 2

Share this post


Link to post

TGuage might have been it.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×