在的WinForms透明背景? [英] Transparent background on winforms?
问题描述
我想使我的窗户形成透明的,所以删除了边界,控制和一切只剩下形式框,然后我试图把背景色和TransparencyKey透明,但它没有工作了作为背景色不会接受透明的颜色。周围搜索后,我发现这个在MSDN:
I wanted to make my windows form transparent so removed the borders, controls and everything leaving only the forms box, then I tried to the BackColor and TransparencyKey to transparent but it didnt work out as BackColor would not accept transparent color. After searching around I found this at msdn:
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;
this.TransparencyKey = BackColor;
Unhappyly它也不能工作。我仍然得到灰色或任何其他选择的颜色背景。
Unhappyly it did not work either. I still get the grey or any other selected color background.
所有我想做的事就是有Windows窗体透明,这样我可以使用,如果它是我的窗口形式,将采取行动的背景图像。
All I wanted to do is to have the windows form transparent so I could use a background image that would act as if it was my windows form.
我搜索在这里,看到不透明度方面的许多主题这是不是我找的,也看到了一些问候这个方法我是想,但还没有找到答案。
I searched around here and saw many topics in regards opacity which is not what I am looking for and also saw some in regards this method I was trying but have not found an answer yet.
希望每个人都可以照亮我的道路。
Hope anyone can light my path.
更新:
问题作为去除图像解决
推荐答案
我以前用的方式是使用背景色野生色(颜色没有一个心智正常的人会使用),然后设置透明度的关键了这一点。
The manner I have used before is to use a wild color (a color no one in their right mind would use) for the BackColor and then set the transparency key to that.
this.BackColor = Color.LimeGreen;
this.TransparencyKey = Color.LimeGreen;
这篇关于在的WinForms透明背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!