Ed.
Ed.

Reputation: 966

Can I create a window whose client area is transparent (using transparency key) and be click through?

Using C# I create a window whose border is normal, but the client area is transparent (using the transparency key). On XP I was able to click through this (accessing the items below the transparent area); however, this doesn't work on W7. Is there a way to make this work for W7 (and XP)?

UPDATE: Thanks to all for the quick responses! Looks like the key to my problem was the unlucky fact that I happened to use YELLOW as my transparency key. I wanted it to stand out in Visual Studio so that I would remember that it was transparent; and that color choice is what was keeping click-through from working. As soon as I changed to a backcolor that was gray, it worked fine.

Upvotes: 3

Views: 765

Answers (2)

Raj Ranjhan
Raj Ranjhan

Reputation: 3915

According to this post, the workaround is to set the TransparencyKey to Gray

  this.BackColor = Color.Gray;
  this.button1.BackColor = Color.Blue;
  this.TransparencyKey = Color.Gray;

Upvotes: 2

Sergey Podolsky
Sergey Podolsky

Reputation: 157

this.TransparencyKey = this.BackColor;

This works fine for me in Windows 7.

enter image description here enter image description here

Upvotes: 0

Related Questions