如何使表单的背景透明?在 C# 中可以吗?
How I make a background transparent on my form? Is it possible in C#?
提前致谢!
您可以将表单的 BackColor 设置为不常见的颜色(例如 Color.Magenta)然后将表单的 TransparencyKey 属性设置为相同的颜色.然后,将 FormBorderStyle 设置为 None.
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.
这篇关于使表单的背景透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
有没有办法知道是否有人为您的网站添加了书签Is there a way to know if someone has bookmarked your website?(有没有办法知道是否有人为您的网站添加了书签?)
使用不同的 .Net 语言?Use of Different .Net Languages?(使用不同的 .Net 语言?)
是否有执行 Excel NORMINV 函数的 C# 库?Is there a C# library that will perform the Excel NORMINV function?(是否有执行 Excel NORMINV 函数的 C# 库?)
确定 ASP.NET 站点的“活动"用户数Determining an #39;active#39; user count of an ASP.NET site(确定 ASP.NET 站点的“活动用户数)
从 C# 中的加权列表中选择 x 个随机元素(无需替换Select x random elements from a weighted list in C# (without replacement)(从 C# 中的加权列表中选择 x 个随机元素(无需替换))
跟踪当前在线用户的最佳方式Best way to keep track of current online users(跟踪当前在线用户的最佳方式)