Is it possible to have two overlapping PictureBox controls with transparent images?

Uwe Keim picture Uwe Keim · Jul 10, 2012 · Viewed 26.4k times · Source

Having two overlapping PictureBox controls, I'm trying to make the transparent areas of the picture box let the controls below (in the z-order) being visible.

Even after trying what Microsoft suggests, I cannot get the desired result.

This is what I currently have:

enter image description here

And this is what I want:

enter image description here

So my question is:

Any way to achieve my desired result with two PictureBox controls (or with another way) that overlap each other and let the transparent areas shine through?

Update:

Actually I solved it by using this answer to the the SO question "Transparent images with C# WinForms".

Answer

Alessio Koci picture Alessio Koci · Jul 10, 2012

Try this

private void Form1_Load(object sender, EventArgs e)
{
  // Transparent background...  
  pictureBoxOverlay.BackColor = Color.Transparent;

  // Change parent for overlay PictureBox...
  pictureBoxOverlay.Parent    = pictureBoxMain;

 // Change overlay PictureBox position in new parent...
 // pictureBoxOverlay.Location  = new Point(0, 0);
}

Result

enter image description here

Link