Transparent BackStyle for label

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

In the 'good old days' of vb6, labels had a 'BackStyle' property - you could
set them Opaque or Transparent.

I have a need for the Transparent attribute - - in VB.Net (2005), how can
this be accomplished?
 
I initially thought the same thing, however, it doesn't work - it just gives
a white background
 
Label supports a transparent background, but some controls do not (ie,
textbox).
If I set a form's BackgroundImage property and then drop a Label on
the form and set its BackColor as:

label1.BackColor = Color.Transparent

then the bitmap background of the form shows through the label as
expected.

====================
Clay Burch
Syncfusion, Inc.
 
Totally understood - - -
In this case, the entire form has a fully docked PictureBox with an image.

(I haven't tried setting the Transparency in code) I set the background
color of the label (on top of the picturebox) to transparent, using the
Properties window. I would expect the image (as you say) to show through the
label. However, instead of this, it shows a murky white color as the
background.

could it be because I'm using the picture box, instead of making the image
be the background image of the form?
 
Totally understood - - -
In this case, the entire form has a fully docked PictureBox with an image.

(I haven't tried setting the Transparency in code) I set the background
color of the label (on top of the picturebox) to transparent, using the
Properties window. I would expect the image (as you say) to show through the
label. However, instead of this, it shows a murky white color as the
background.

could it be because I'm using the picture box, instead of making the image
be the background image of the form?

When you set the background color of the label to Transparent, what
shows through it the Label's container. It's not a true transparent
label.

When you drag a label on top of a PictureBox, the Label's container is
still the form and not the picturebox. You need to set the parent
property of the label to the PictureBox then the PictureBox should
show through the label.
 
Back
Top