0

I have a picture which i want to display above another picture. so i use this answer How to make picturebox transparent?. But now when i add another picture (pictureBox3) it doesn't transpar with the first one (pictureBox2). This is how it is look like - Do not pay attention to the third green picture. pictureBox1 is the black shape. My code:

public Form1()
    {
        InitializeComponent();

        Control[] controls = { pictureBox2, pictureBox3 };

        pictureBox1.Controls.AddRange(controls);

        pictureBox2.Location = new Point(95, 10);
        pictureBox3.Location = new Point(150, 40);
        pictureBox2.BackColor = Color.Transparent;
        pictureBox3.BackColor = Color.Transparent;
    }

How can i make it transaer with all the pictures?

Community
  • 1
  • 1
bar
  • 25
  • 1
  • 2
  • 6
  • In other words, *this* is the result you want to see? ( http://i.stack.imgur.com/N9JVM.png) i.e. you're having problems that the rectangular shapes of the `PictureBoxes` overlap and they occlude each other? You could change the z-Order (/drawing order) of these two pictureboxes, sothat the right one is always on top, but that would only generate more problems with more pictureboxes. (https://stackoverflow.com/questions/3213270/how-to-set-z-order-of-a-control-using-winforms). Maybe it'd be better to generate a new bitmap which has all the green shapes drawn over the cube. – Maximilian Gerhardt Jan 22 '16 at 22:39
  • __Overlapping__ controls do not support transparency well under winforms. You may either __draw__ the stuff or set a __region__ to the controls. Note that __nested__ controls work fine. – TaW Jan 23 '16 at 22:48

0 Answers0