Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent Windows Form that can handle Click

Tags:

c#

.net

winforms

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.

like image 359
linkhyrule5 Avatar asked Sep 25 '15 13:09

linkhyrule5


1 Answers

If I understand your question correctly, you can Use TrancparencyKey

Set TrancparencyKey and BackColor properties both to same color like Color.Red.

Here is the screenshot of transparent form over visual studio:

enter image description here

Note:

  • 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.
like image 176
Reza Aghaei Avatar answered Oct 19 '22 15:10

Reza Aghaei