Labels and transparency

Started by Joakim Schramm, February 19, 2010, 12:09:01 PM

Previous topic - Next topic

Joakim Schramm

Hi,

I'm trying my first exe project in FF3, a small menu program to be put in root of CD's. It's just 1 form and I have a streched bitmap as backgroun, now trying to put some text on the form using labels with transparent background. I notice though the (label) background isn't truly transparent at all! Is this a bug or a "limitation" of the current implementation of labels?

It appears as if the label takes a "snapshot" of the current background when you set Backstyle to 0-Transparent, and then it just stay and it's not even in phase with the form background but show with quite some offset and clear "borders" around the lable client area.

Paul Squires

It is a limitation of the way that "Labels" (ie. Static class), work. Using transparent on a bitmap will not always get you the desire effect. The best alternative that I can think of is to use the form's WM_PAINT and get the hDC of the bitmap and use the GDI functions to draw the text yourself on top of it. Not an overly easy thing to do if you don't have much Windows api experience.
Paul Squires
PlanetSquires Software

Joakim Schramm

As I expected and you are right, I still have a lot to learn regarding api programming. I have just started to read the Petzold book, but for now I think I have to find a simpler solution.