trasparent text on a toolbar button

I would like to add a simple text on a toolbar imaged-button using a TLabel or a TStaticText component, in this way I can change the text on the button at run-time and customize it. I tried with a TLabel component, setting its Trasparent property to true, but it not works on the toolbar. I tried to add a WMCTLCOLORSTATIC message using a TStaticText component and pass NULL_BRUSH (or HOLLOW_BRUSH) as result, but it still not works (it is not trasparent).
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sorry, but I don't understand your problem. You can directly access toolbar buttons and set their caption to whatever you need. Why going the long way using additional controls?

Ciao, Mike
men xinCEOCommented:
You want to cover the toolbutton.caption?

gianlucaAuthor Commented:
I use a ImageList to cover the button with some icons, but in the same time I want put a label on this image; and I need to change this text at runtime.
You could derive a new class from the toolbar button. Override the paint event like this:

  procedure Paint; override;

and implement it like this

procedure TMyToolButton.Paint;
  SetBkMode(Canvas.Handle, TRANSPARENT);
  Canvas.TextOut(0, 10, Caption);


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
What's with the C grade on a comment you stingy p***k? If you don't like a comment, then don't turn it into an answer.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.