简体   繁体   English

将我的PictureBox设置为透明的背景颜色并不能真正使其透明。 虫子?

[英]Setting my PictureBox to transparent background color doesn't really make it transparent. Bug?

Here's what I have in VERY simple easy to grasp terms. 这就是我非常简单易懂的术语。

  1. My form background is Blue. 我的表单背景是蓝色。

  2. I created a gradient image from white to the Blue from the form background. 我从表单背景创建了一个从白色到蓝色的渐变图像。 This is to give the form a nice gradient look. 这是为了使表单具有良好的渐变外观。 I added a picturebox to my Form and set this image as the Image. 我在我的窗体中添加了一个图片框,并将此图像设置为图像。

  3. I added a picturebox with a Logo on top of the gradient Picturebox, but it's 'grabbing' the Form background color and not respecting the transparent background image I wanted it to grab. 我在渐变图片框的顶部添加了一个带有徽标的图片框,但这是在“获取”表单背景颜色,而不尊重我希望它抓取的透明背景图像。

So: 所以:

Blue Form -> Huge pictureBox with gradient -> Small picturebox thats supposed to respect the gradient. 蓝色表格->带有渐变的巨大picturebox->应该尊重渐变的小picturebox。

Help please! 请帮助!

I think this might be as the PictureBox is not a control container. 我认为这可能是因为PictureBox不是控件容器。 So this implies that when you drag the button picture box onto the main picture box, it is not actually a child of the picturebox, but rather of the form. 因此,这意味着将按钮图片框拖动到主图片框时,它实际上不是图片框的子级,而是窗体的子级。

You would notice that if you were to do he same with a panel (set the form blue, panel background image, and place the button picture box control on the panel) it would show transparent to the panel control. 您会注意到,如果要对面板执行相同操作(将表单设置为蓝色,面板背景图像,并将按钮图片框控件放置在面板上),则该面板控件将显示为透明。

Why not rather set the Form BackgroundImage , avoid the Huge Picture Box , and set the small picture box on the form itself. 为什么不设置Form BackgroundImage ,避免使用Huge Picture Box ,并在窗体本身上设置小图片框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM