简体   繁体   English

透明的图片框在另一个透明的图片框c#

[英]Transparent picturebox over another transparent picturebox c#

I'm having this problem. 我有这个问题。 I would like for the frog's background to be transparent so the log underneath can be seen, but instead, the background picturebox's color is shown. 我希望青蛙的背景是透明的,以便可以看到下面的日志,但可以显示背景图片框的颜色。

problem 问题

I googled the problem and got the suggestion to change the Parent of the picturebox, which i tried, but this happened: 我用谷歌搜索了问题并得到了改变图片框的父母的建议,我试过了,但这发生了:

it works, but only in the log's picturebox area 它有效,但仅在日志的图片框区域中

I'm clearly doing something wrong. 我显然做错了什么。 Can somebody help? 有人可以帮忙吗?

WinForms does not support true alpha-transparency. WinForms不支持真正的Alpha透明度。 "Transparent" controls re-render only the parent form's background behind themselves - controls cannot be truely layered and blended in the Z-axis. “透明”控件仅重新渲染父窗体背后的背景 - 控件无法在Z轴上真正分层和混合。

So what you're after really isn't possible. 所以你真正想要的是不可能的。

However, implementing a game using WinForms controls and GDI ( System.Drawing ) is a bad idea - performance is terrible (in part due to Microsoft's crippling of GDI since Windows Vista by removing hardware acceleration of many operations) and there are endless issues with inconsistent double-buffering and DPI-scaling. 然而,使用WinForms控件和GDI( System.Drawing )实现游戏是一个坏主意 - 性能非常糟糕(部分原因是微软自Windows Vista以来通过删除许多操作的硬件加速而导致GDI严重崩溃)并且存在无限的不一致问题双缓冲和DPI缩放。

I suggest you rewrite your game's rendering layer in Unity, Direct2D or SDL. 我建议你在Unity,Direct2D或SDL中重写游戏的渲染层。

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

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