C# - 透明表 [英] C# - Transparent Form

查看:127
本文介绍了C# - 透明表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有除此之外的所有预期的效果表单。目前的形式包括了与在其下包含标签和pictureboxes面板顶部的MenuStrip的。当表单推出的MenuStrip是不可见的,它只有在用户按下'Alt'按钮和以相同的方式消失变得可见。

I currently have a Form with all the desired effects except one. The current form consists out of a menustrip at the top with a panel underneath which contains labels and pictureboxes. When the form is launched the menustrip is not visible, it only becomes visible while the user presses the 'Alt'-button and disappears in the same manner.

,主机将有一个透明背景(.PNG)背景图像。此图片将成为形式的主要布局在我边框样式设置为无。现在的问题是,形式仍具有面板下方的白色/灰色背景。

The panel will have a background-image with a transparent background (.PNG). This image will become the main layout of the form as I set the borderstyle to none. Now the problem is that the form still has the white/grayish background underneath the panel.

现在我的问题是我该做出怎样的形式透明,这样面板上的图像成为主要的布局,而不是仅仅在图像的形式背景色它下面。我不想因为我想在面板可见100%使用Opacity属性。

Now my question is how do I make the form transparent so the image on the panel becomes the main layout rather than just the image with the forms backcolor underneath it. I do not want to use the Opacity property as I want the panel to be visible 100%.

推荐答案

假设的WinForms。

Assuming WinForms.

您可以做到这一点,但您不能使边缘半透明。

You can do this, but you cannot make the edges semi-transparent.

试试这个

在的形式,设置以下属性:

On the form, set the following properties:

BackColor = Color.Lime;
TransparencyKey = Color.Lime;

这将使形式透明。然后设置背景图片:

This will make the form transparent. Then set the backgroundimage:

BackgroundImage = myImage:

和backgroundImage这也是 Col​​or.Lime 的部分也将得到透明的。

The parts of the backgroundimage that is also Color.Limewill also get transparent.

如果你也想摆脱形式边框,加入这一行,以及:

If you also want to get rid of the Forms borders, add this line as well:

FormBorderStyle = FormBorderStyle.None;

这篇关于C# - 透明表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆