How i make a label's backcolor transparent on the picturebox ?
-
i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)
Why are you putting a label OVER the picturebox? Are you sure that the picturebox is actually linked to an image and showing it?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
Why are you putting a label OVER the picturebox? Are you sure that the picturebox is actually linked to an image and showing it?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)
With .Net I have not found a way to use transparency with labels and show the background like you can do with VB6. I have had to resort to keeping the label hidden and using it's text,location, etc. in the picture box's OnPaint event using a graphics object to draw the text on the picture box. Hope that helps :)
-
i set the backcolor of label to Transparent and it's parent to picturebox but nothing appear in runtime :( ??? (picturebox exist under the label)
I was able to add a label to a picturebox and it's transparency worked fine. How are you creating the label. Is it done at runtime or design time. Remember that the location of a control is relative to it's parent. So if the label exists at design time and is located 100 from the left and 200 from the top it will be in that same relative position when you set it's parent to the picturebox. What may be happening is when you set the parent to the picturbox the label is positioned where you can't see it. Try setting it's position to (0,0) and see if it shows up. As proof of concept try creating a new project. Add a label and a picturbox to your form as well as a button. To prove the transparency works give the picturbox an image. Then add this code.
Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Set the parent Label1.Parent = PictureBox1 'Position the label so we can see it Label1.Location = New Point(0, 0) 'Give it a transparent background Label1.BackColor = Color.Transparent End Sub