开发者

C# Form's background image as pictureBox parent?

开发者 https://www.devze.com 2023-03-16 14:13 出处:网络
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

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 pictur开发者_开发技巧ebox's parent?

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


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

pictureBox1.BackColor = Color.Transparent;


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号