透明的Windows窗体可以处理点击 [英] Transparent Windows Form that can handle Click

查看:150
本文介绍了透明的Windows窗体可以处理点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作在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.

推荐答案

如果我正确地理解你的问题,你可以使用的 TrancparencyKey

If I understand your question correctly, you can Use TrancparencyKey

设置 TrancparencyKey 背景色属性都以相同的颜色像 Col​​or.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:

请注意:


  • 当你使用例如 Col​​or.Red 每一件事工作正常,你可以处理鼠标点击。但是,行为是不同的颜色不同,例如 Col​​or.Magenta 的形式不能捕获鼠标点击

  • When you use for example Color.Red every thing works fine and you can handle mouse Click. But the behavior is different for different colors, for example Color.Magenta the form can not capture the mouse Click.

这篇关于透明的Windows窗体可以处理点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆