Transparent Label

M

Martin

I've been complaing about the VB2005 Help-Information (or rather the lack of
it) before, but when I was looking how to set the backstyle of a label
control to "Transparent" I found that the VB2005 documentation has reached
an all-time low (please note the part about the z-order):

MSDN:
In Visual Basic 6.0, the BackStyle property of the Label control determines
whether the label had a transparent background. Setting the BackStyle
property to 0 - Transparent allows any background image to show through the
label. If the label is placed over other controls, the controls also show
through.

In Visual Basic 2005, the BackStyle property no longer exists and the
transparency behavior is slightly different (YES, IT DOESN'T EXIST). To
emulate the transparent behavior in Visual Basic 2005, set the BackColor
property to Transparent. This will allow the background image to show
through. If the label is placed over other controls, the controls will show
through only if they are higher in the z-order (Z-ORDER YOU SAID? KEEP
READING!)

Note
The ZOrder method no longer exists in Visual Basic 2005. At design time you
can use the Bring to Front or Send to Back command on the Format menu; at
run time you can use the BringToFront or SendToBack function.

No transparency, No z-order.... What will we do now? The Microsoft solution
is to move the Picture to the front... How many do you think would still be
able to read the label? But ok, we can see the picture... Transparency
"Flintstones Style" ;-)
 
G

Guest

Hi,

When you set the backcolor of a control to transparent it will take
it parents background. So if your label is over a picturebox and its parent
is the form the forms background will show. So add the control to the
picturebox's controls collection.

Ken
 
M

Martin

Ken,

Thanks a lot! It works like a charm! I achieved this by opening the
MyForm.designer.vb file and change the following line:

Me.Controls.Add(Me.lblHeader)

into:
Me.PictureBox1.Controls.Add(Me.lblHeader)

But that was in the code marked with:
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.

How do you modify a controls parentage with the designer?

Tia,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top