问题描述
我工作在C#,Visual Studio中,我试图做一个透明的形式 - 完全透明的,虽然不是点击率 - 未做标题栏透明,让还是有东西四处移动(无形)窗口(最重要的)关闭它。
I'm working in C#, in Visual Studio, and I'm trying to make a transparent form - entirely transparent, though not click-through - without making the title bar transparent, so that there's still something to move the (invisible) window around and (most importantly) close it.
这会也是,如果窗口不错有明显的边界,但是这可能是一个单独的问题。
It'd also be nice if the window had visible borders, but that may be a separate question.
推荐答案
如果我正确地理解你的问题,你可以使用的
If I understand your question correctly, you can Use TrancparencyKey
设置 TrancparencyKey
和背景色
属性都以相同的颜色像 Color.Red
。
Set TrancparencyKey
and BackColor
properties both to same color like Color.Red
.
下面是透明的屏幕截图在表格的Visual Studio:
Here is the screenshot of transparent form over visual studio:
请注意:
- 当你使用例如
Color.Red
每一件事工作正常,你可以处理鼠标点击
。但是,行为是不同的颜色不同,例如Color.Magenta 的形式不能捕获鼠标
点击
。
When you use for example
Color.Red
every thing works fine and you can handle mouseClick
. But the behavior is different for different colors, for exampleColor.Magenta
the form can not capture the mouseClick
.
这篇关于透明的Windows窗体可以处理点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!