01-07-2005, 01: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, 01:35 PM
Set the Backstyle property of the control to 0-Transparent.
01-10-2005, 08: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...
check out the Alphablend (http://www.mentalis.org/apilist/AlphaBlend.shtml) 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, 02: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_SINGLELINE = &H20
Const DT_NOCLIP = &H100
Const DT_CENTER = &H1
Const DT_VCENTER = &H4
Const DT_WORDBREAK = &H10
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.