469,573 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

transparent labels on pictureboxes

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
Jun 4 '06 #1
2 3437
ag
Put these lines after your mentioned code:

Label1.Location=New Point(1,1)
Label2.Location=New Point(1,1)

Then you can see your labels. :)

The problem was, when u r assigning a label to new parent, it will
calculate some relative position depending on the label's previous
parent's Location i.e. the Form itself. Surprisingly the labels were
there and u coudnt see it becoz ur picturebox is small. Resize ur both
picture box to big, then u can see ur labels OR u assign label to new
location (i.e. 1,1 or anything ) RELATIVE TO picturebox i.e. its new
parent.

Regards,
ag

Jun 4 '06 #2

woah you did it !!!!!! i spent a lot of time about this.... suspecting a bug
around png file etc.... aaargh!
now it's perfect ! thanks to be so fast !

here is the code
:
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

Label2.Location = New Point(19, 15)

Label3.Parent = PictureBox2

Label3.BackColor = Color.Transparent

Label3.Location = New Point(110, 15)

Label4.Parent = PictureBox2

Label4.BackColor = Color.Transparent

Label4.Location = New Point(196, 15)

End Sub

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

Label2.Location = New Point(19, 15)

Label3.Parent = PictureBox2

Label3.BackColor = Color.Transparent

Label3.Location = New Point(110, 15)

Label4.Parent = PictureBox2

Label4.BackColor = Color.Transparent

Label4.Location = New Point(196, 15)

End Sub

http://www.scalpa.info
Jun 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Steve Barnett | last post: by
1 post views Thread by active | last post: by
3 posts views Thread by SStory | last post: by
1 post views Thread by Ricardo Furtado | last post: by
3 posts views Thread by vul | last post: by
8 posts views Thread by Brian Ward | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.