There are three consecutive layers, picturebox1(.jpg) -> label1 -> picturebox2(.png transparent)
what i want is to make the label1 and pictrurebox2 transparent to the picturebox1 so that label1 can be see through the picturebox2 but its not working..
public Form1()
{
InitializeComponent();
label1.Parent = pictureBox1;
label1.BackColor = Color.Transparent;
pictureBox2.Parent = pictureBox1;
pictureBox2.BackColor = Color.Transparent;
picturebox2.BringToFront();
}
so please help me
If you need a control support transparency, you should override painting of the control and draw the control in this order:
BackColor
of your control should beColor.Transparent
.Here is the result of creating
TransparentLabel
andTransparentPictureBox
controls. In the below image, there is label, image, label, image and then label in order and as you can see picture boxes and labels has been rendered having transparent background and respecting the z-index:Transparent Label
Transparent PictureBox