Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top