制作表格的背景透明 [英] Make a form's background transparent
问题描述
我如何让我的表格背景透明?是否有可能在C#?
How I make a background transparent on my form? Is it possible in C#?
在此先感谢!
推荐答案
您可以设置背景色
的表单来少见的颜色(比如 Color.Magenta code>),那么表单的
TransparencyKey
属性设置为相同的颜色。然后,将 FormBorderStyle
到无
。
You can set the BackColor
of your form to an uncommon color (say Color.Magenta
) then set the form's TransparencyKey
property to the same color. Then, set the FormBorderStyle
to None
.
当然,这只是快速和简单的解决方案。控件的边缘是丑陋的,你要好好改变你加(如果他们的按钮或类似的东西)和其他问题一大堆新控件的背景颜色。
Of course, that's just the quick and easy solution. The edges of controls are ugly, you have to keep changing the background color of new controls you add (if they're Buttons or something like that) and a whole host of other problems.
这真的取决于你想要达到的目标。它是什么?如果你想使一个小部件类的事情,有很多更好的方法。如果您需要圆角或自定义背景,有很多更好的方法。所以,请提供一些更多的信息,你脑子里想,如果 TransparencyKey
不完全是。
It really depends what you want to achieve. What is it? If you want to make a widget sort of thing, there are much better ways. If you need rounded corners or a custom background, there are much better ways. So please provide some more information if TransparencyKey
isn't quite what you had in mind.
这篇关于制作表格的背景透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!