By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

transparent labels on pictureboxes

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a

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.