[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

trasparent text on a toolbar button

Posted on 1999-12-03
5
Medium Priority
?
296 Views
Last Modified: 2010-04-06
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).
0
Comment
Question by:gianluca
5 Comments
 
LVL 10

Expert Comment

by:Lischke
ID: 2252431
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
0
 
LVL 1

Expert Comment

by:men xin
ID: 2252611
You want to cover the toolbutton.caption?

menxin
0
 

Author Comment

by:gianluca
ID: 2254909
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.
0
 
LVL 3

Accepted Solution

by:
philipleighs earned 200 total points
ID: 2256624
You could derive a new class from the toolbar button. Override the paint event like this:

....
protected
  procedure Paint; override;

and implement it like this

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

Cheers,
Phil.
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 2259944
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.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

613 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question