问题描述
我想设计一个半透明的屏幕如Adobe Photoshop的和在打开应用程序的视觉工作室半透明欢迎闪屏。我设置FormBorderStyle为无,我把一个图片就可以了,我加入了png图片吧,我设置图片框颜色为透明的,但我不能设置窗体的背景颜色为透明。下面是exmples:
I am trying to design a semi transparent screen as Adobe Photoshop's and visual studios semi transparent welcome splash screen while opening the Application. I set FormBorderStyle to none, And I place a picturebox on it and I added a png image to it, I Set picturebox color to transparent, But I am not able to set Form's back color as transparent. Below are exmples:
和当我设置窗体的背景颜色为透明的,它让我误差
and when I set form's Back Color as transparent, it shows me error
属性无效。 。控制不支持透明背景颜色
我如下图所示已经尝试过几个代码示例:
I already tried couple of code samples as shown below:
public Splash_Screen()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
InitializeComponent();
this.BackColor = Color.Red;
BackColor = Color.Transparent;
}
和
public Splash_Screen()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
InitializeComponent();
}
但是没有什么工作对我来说..有什么建议?
But nothings works for me.. Any suggestions?
推荐答案
您设置半透明的背景图像的BackgroundImage
形式的财产。然后设置一个背景色
到表单,和窗体的 TransparencyKey
属性设置为您设置相同的颜色你表格背景色
。然后,通过改变形式的 FormBorderStyle
属性无
删除表格的边框。这将做到这一点。
You set your semi transparent background image to BackgroundImage
property of the form. Then set a BackColor
to your form, and set the TransparencyKey
property of the form to the same color you set for your forms BackColor
. Then remove the borders of the form by changing FormBorderStyle
property of the form to None
. That will do it.
这篇关于如何设计一个很酷的半透明闪屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!