Transparent Label

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
 
Kulrom, Kool Tip!!!

heres the code from Kulrom...

In Form_Load...

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

Thanks! :)
 
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 ;)
 
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
 
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:
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)
 
Back
Top