[英]C# Form's background image as pictureBox parent?
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.
我发现我可以使用picturebox.Parent 来设置父图像,但它只在Parent 是另一个图片框时才有效。 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
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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.