Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcefully hiding the text of a TCustomLabel?

Status
Not open for further replies.

djjd47130

Programmer
Nov 1, 2010
480
US
I am making a custom label, and am inheriting it from a TCustomLabel. I am doing my own drawing directly to the canvas, but since I implemented the Transparent mode, I realized that the original caption is still showing behind my drawing regardless of clearing it. How can I keep the original inherited caption from drawing in a TCustomLabel component?


JD Solutions
 
BTW, I'm creating a custom label component inherited from the TCustomLabel, republishing selected properties, and doing a certain custom drawing which should override the original caption drawing. I did an override on the paint procedure to draw my own stuff, which I do a FillRect on the label's canvas before I draw, which should clear over the original label drawing, but doesn't. When in transparent mode, I can still see the inherited caption showing behind my drawing.

JD Solutions
 
Nevermind, I solved it. I did an override of the Caption and made my own caption property in its place, which a) sets the inherited caption to blank, and b) draws my custom caption instead.

I should have known better :p If I were using a TCustomControl like I was going to, it would have been easy, but the TCustomLabel already has all the properties I need.

Now if I can only figure out how to implement auto wrapping the text...

JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top