Peter
Peter

Reputation: 1444

Paint TProgressBar behind text and icon in TSpeedButton

Is it possible to paint a TProgressBar on a TSpeedButton, behind text and icon ?

I have no idea how to get started on this (assuming it's possible). How would I go about it ?

In this particular case I use the button to start and stop a process, and it would be nice to display the process in that button as well.

Upvotes: 0

Views: 176

Answers (1)

Ken White
Ken White

Reputation: 125620

No, this is not possible with the standard TSpeedButton without creating your own descendant.

TSpeedButton does all of its drawing in response to the WM_PAINT message, and there is no way for you to inject another control behind the content that is drawn, because the drawing would erase the area where your control is drawing itself. You can see this yourself; you have the source code for TSpeedButton in almost every Delphi and C++ Builder version.

In addition, a TSpeedButton is a graphical control, not a windowed control (it derives from TGraphicControl instead of TWinControl), so it does not have a window handle to be used as the parent for other controls.

Upvotes: 6

Related Questions