0

I have a picture box called pictureBox1, and I have a label called label1, which is supposed to be located in the middle of the picture box.

On the picture box I need to draw a circle. The result is this. Is there a way I can make the label background be transparent so it doesn't overwrite the circle?

If needed I can provide some code but there isn't really much of it, just a simple drawEllipse method and thats it.

Stralz
  • 19
  • 8
  • Yes, override the paint event. You can just draw using it as well. Just do a search on override paint event. – Trey Apr 03 '18 at 12:41

1 Answers1

0

To make the background of a label transparent, change the Parent property of the label to the picturebox. This will make the position of the label relative to the position of the picturebox, so you will need to recalculate the position of the label.

See this post for more information: Transparent control over PictureBox

EDIT: This code should work for you

        label1.BackColor = Color.Transparent;
        label1.Parent = pictureBox1;
        label1.Location = new Point(label1.Location.X - pictureBox1.Location.X, label1.Location.Y - pictureBox1.Location.Y);
Lennart
  • 752
  • 1
  • 5
  • 18