0

I have a picturebox with some transparency. I found out I can use picturebox.Parent to set the parent image, but it only works when Parent is another picturebox. But what if i want form's background image to be picturebox's parent?

   pictureBox1.Parent = PictureBox2; //works fine (of course if there is a pbox2)
   pictureBox1.Parent = Form1;  //??? magic goes here

2 Answers2

0

If I understood well, you want that your background would be transparent. If so, use:

pictureBox1.BackColor = Color.Transparent;
Donatas K.
  • 866
  • 8
  • 9
  • i tried but it gives me `Error Cannot implicitly convert type 'System.Drawing.Color' to 'System.Windows.Forms.Control'` –  Jul 01 '11 at 13:47
  • ah yes, didn't notice the `BackColor`. Thanks –  Jul 01 '11 at 13:57
0

Are you trying to use an image with transparency as the background to your form? If so, you can't do that you have to use a transparency key.

what you are trying to do above works this way but I don't know what that would accomplish...

Form1 theForm = new Form1();

pictureBox1.Parent = theForm;
Spacemancraig
  • 1,386
  • 2
  • 12
  • 24
  • not. i'm trying to use a transparent picturebox over a form that has a background image –  Jul 01 '11 at 13:55