Translucent Labels

01-07-2005, 12:00 PM

Is it possible to create translucent Labels in VB6?
It works for forms. But is it applicable to labels as well??

Thanx in advance.

01-07-2005, 12:35 PM
Set the Backstyle property of the control to 0-Transparent.

01-10-2005, 07:37 AM
But Transparency isn't Translucency (does that word exist)??
Here's an example for a tranlucent label:

The labels DO have a background color (blue in this case) ,,but you can still the background pic of the form...

01-11-2005, 12:28 PM
check out the Alphablend ( function.

Use this to draw a rectangle (or another shape but this is slightly more complicated) with the desired transparancy.

Then put the text on top of it

01-11-2005, 01:09 PM
Labels are lightweight controls... therfore they do not have an .Hwnd or .hdc property needed to do GDI functions with.

You may need to look at possibly using a picturebox with the alphablend mentioned earlier.

As far as getting text to the picturebox, you can look up the DrawText API.

Here's an example of using DrawText to put text on a picbox.
I used GetClientRect to determine the area for DrawText.

Some constants for DrawText that may be missing from AllAPI

Const DT_NOCLIP = &H100
Const DT_CENTER = &H1
Const DT_VCENTER = &H4
Const DT_CALCRECT = &H400

Also, since this is still up... here's Ricardo's Alpha-blend tutorial.
It's used in a 'game' style example, but is useful for understanding how the Alpha blend process works.

Have fun!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum