3

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?

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Guy Levin
  • 1,230
  • 1
  • 10
  • 22

1 Answers1

3

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.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398