Trying to make a form's background transparent, without it losing its ability to receive clicks.

this.Opacity makes the whole form transparent (not just the background

BackColor = Color.Red; 
TransparencyKey = BackColor;

makes the background of the form transparent and click through-able. I want the form to be transparent , but it should be able to receive clicks

how?

Someone suggest overwriting WndProc to change HTCAPTION . BUt after trying that, the form is still click through-able

Also this form is also the 'base' form.

Thanks

Why not just take a picture of what is behind the form and show that, mimicing transparency?

It will be the base form . the main 'window' .
whatever that is behind the window will always be changing..

OK!
I hadn't thought of it that way. I'll look into it. thanks

btw I am novice, so I am wondering if this could make my app 'slower' on a low end machine

Absolutely. Every line of code that executes on a client machine slows your app down :)

The real question is -- Does this slow it down enough to matter? No, it doesn't. You should be fine.

hi again!
one problem - the form itself is included if copyfromscreen() is used to take capture screen. Is there a way to take a capture of the window behind the form?

In OnPaint() ->

Point zero = new Point(0,0) ;
Graphics g = pea.Graphics ;
g.CopyFromScreen(this.Location, zero, this.Size);

OnPaint() is being called every second with a Timer. I guess I have to change this.Location..

my form is topmost btw..

Edited 7 Years Ago by kutchbhi: n/a

This article has been dead for over six months. Start a new discussion instead.