Label with Transparent Background

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to have text displayed over a picturebox with an image in it. When
using a label whose BackColor = System.Drawing.Color.Transparent, the
background is not transparent.

I came across this explanation as to why .Net does not support transparent
backgrounds.

************
[In Visual Basic 6.0, the BackStyle property of the Label control determined
whether the label had a transparent background. Setting the BackStyle
property to 0 – Transparent allowed any background image or other controls to
show through the label.

In Visual Basic .NET, the BackStyle property no longer exists, and the
transparency behavior is slightly different. To emulate the transparent
behavior in Visual Basic .NET, set the BackColor property to
System.Drawing.Color.Transparent. This will allow the background image to
show through, but it will not be transparent in regard to other controls.]
**********************

The last phrase is mindboggling, " . . . but it will not be transparent in
regards to other controls." What good it is then??? Why would any lanquage
designer not support such a useful property?

How do I get a label to have a true transparent background??

WR
 
When you set the label to transparent, it is transparent only to its
parent, in this case the form, so it shows the form's background
through the label.

If you want to to show the picture box through the label, you must set
the parent of the label to be the picture box:
Label1.Parent = PictureBox1

Then the label will display properly.
 
WhiskyRomeo said:
I need to have text displayed over a picturebox with an image in it. When
using a label whose BackColor = System.Drawing.Color.Transparent, the
background is not transparent.

I came across this explanation as to why .Net does not support transparent
backgrounds.

************
[In Visual Basic 6.0, the BackStyle property of the Label control determined
whether the label had a transparent background. Setting the BackStyle
property to 0 - Transparent allowed any background image or other controls to
show through the label.

In Visual Basic .NET, the BackStyle property no longer exists, and the
transparency behavior is slightly different. To emulate the transparent
behavior in Visual Basic .NET, set the BackColor property to
System.Drawing.Color.Transparent. This will allow the background image to
show through, but it will not be transparent in regard to other controls.]
**********************

The last phrase is mindboggling, " . . . but it will not be transparent in
regards to other controls." What good it is then??? Why would any lanquage
designer not support such a useful property?

How do I get a label to have a true transparent background??

WR

Hi William,

read this:
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=2132&lngWId=10

Greeting

Thomas
 
thanks for the link. I going to use this.

wr

Thomas Wenning said:
WhiskyRomeo said:
I need to have text displayed over a picturebox with an image in it. When
using a label whose BackColor = System.Drawing.Color.Transparent, the
background is not transparent.

I came across this explanation as to why .Net does not support transparent
backgrounds.

************
[In Visual Basic 6.0, the BackStyle property of the Label control determined
whether the label had a transparent background. Setting the BackStyle
property to 0 - Transparent allowed any background image or other controls to
show through the label.

In Visual Basic .NET, the BackStyle property no longer exists, and the
transparency behavior is slightly different. To emulate the transparent
behavior in Visual Basic .NET, set the BackColor property to
System.Drawing.Color.Transparent. This will allow the background image to
show through, but it will not be transparent in regard to other controls.]
**********************

The last phrase is mindboggling, " . . . but it will not be transparent in
regards to other controls." What good it is then??? Why would any lanquage
designer not support such a useful property?

How do I get a label to have a true transparent background??

WR

Hi William,

read this:
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=2132&lngWId=10

Greeting

Thomas
 
Back
Top