Transparent Label

Brainbug

Member
Joined
Dec 29, 2005
Messages
17
Location
Hanover, Germany
Programming Experience
5-10
Transparency Addon

Hi,

I want to put a transparent label on top of a progress bar (white font, so it will be white on blue when the progress goes on).

Even with the progress bar as parent of the label, the gray background is still shown.

Any suggestions about that one?

Thank you,

Brainbug
 

Merchand

Well-known member
Joined
Dec 28, 2005
Messages
73
Location
USA Eastcoast
Programming Experience
10+
Kulrom, Kool Tip!!!

heres the code from Kulrom...

In Form_Load...

Label1.Parent = PictureBox1
Label1.BackColor = Color.Transparent

Thanks! :)
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
Brainbug said:
Hi,

I want to put a transparent label on top of a progress bar (white font, so it will be white on blue when the progress goes on).

Even with the progress bar as parent of the label, the gray background is still shown.

Any suggestions about that one?

Thank you,

Brainbug

take a look of this thread ... last reply has exactly what do you want
http://www.vbdotnetforums.com/showthread.php?t=7959

Regards ;)
 

scalpa98

New member
Joined
Jun 4, 2006
Messages
1
Programming Experience
Beginner
transparent label

Je veux que mes label soit transparent aussi sur mes picturebox alors
j'écris :
i want my labels to be transparent on my pictureboxes so i wrote :

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
Label1.Parent = PictureBox1
Label1.BackColor = Color.Transparent
Label2.Parent = PictureBox2
Label2.BackColor = Color.Transparent
End Sub

ça marche nickel pour label1 mais pas pour label2....
it works fine for label1 but not for label12

Pourquoi ? J'ai fait exactement la même manip...
why ? I did the same thing for the two labels...

someone has got an idea ?
thanks
pascal
 

Brainbug

Member
Joined
Dec 29, 2005
Messages
17
Location
Hanover, Germany
Programming Experience
5-10
Consider this...

In addition to what Kulrom wrote: notice that (by setting a PictureBox as parent for a label) the coordinate system for the label changes! A label, formerly located at [100, 100] on the Form, added to the children of a PictureBox (which is also located at [100,100]) will be re-located at [200, 200] in "Form-coordinates" (but still at (100,100) in the coordinate system of the PictureBox, which is the new parent)! Thus, the label might disappear, if the image is to small, say 32x32, so that coordinate [100,100], where the label is located now, is not visible.

label.png


Took me a while to realize ;) ...

Brainbug
 
Last edited:

bestdj

New member
Joined
Oct 22, 2009
Messages
1
Programming Experience
5-10
I added the following to my code to auto adjust the coordinates (might be a better way but I am a newbie. :)

Dim xNew, yNew as Single

Label1.Parent = PictureBox1
Label1.BackColor = Color.Transparent
xNew = label1.Location.X - picturebox1.Location.X
yNew = label1.Location.Y - picturebox1.Location.Y
label1.Location = New System.Drawing.Point(xNew, yNew)
 
Top Bottom