Question

I have a panel control over picture box control. Now I want to set the background of the panel as the image is.

enter image description here

Was it helpful?

Solution

If we set panel.BackColor = Color.Transparent; panel becomes transparent and shows parent background color or image. But PictureBox is not container you only place panel on picture box so even if you try panel.BackColor = Color.Transparent; you will not see image of PictureBox. You will try something like this.

panel.Parent = pictureBox;
panel.BackColor = Color.Transparent;

But take care top and left of panel because when you set pictureBox as parent. you will also need to set top and left of panel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top