Transparent Form with Visible Clickable Controls in it

472 Views Asked by At

I'm trying to make a mouse transparent form in win8 and winforms, that contains controls that are clickable.

I'm able to make the form mouse transparent, using this code

int initialStyle = GetWindowLong(this.Handle, -20);
SetWindowLong(this.Handle, -20, initialStyle | 0x80000 | 0x20);

(on win8 the WndProc approach does not work)

But when I make the form mouse transparent, the controls that are contained in this form are also mouse transparent

What can I do?

1

There are 1 best solutions below

0
On BEST ANSWER

You can create a Form and set both BackColor and TransparencyKey properties to Color.Magenta.

Screenshot:

enter image description here

Click pass through window and reaches to what behind it, but of you click on button 1, button will be clicked.

Note: The trick works for some colors, for example if you use Color.Red it will be transparent but handles clicks, but using Magenta the form will be mouse transparent too.