Click windows form transparent C # [closed]

1

I have a transparent windows form for drawing on other screens. For transparency, I've used the following code:

BackColor = Color.Red;
TransparencyKey = Color.Red;

It worked for a while, but now it does not recognize clicks on the screen, it's like clicking through it. Coincidentally or not, it stopped working after a Windows 10 upgrade, and works on other computers.

It was not a modification in the code that made it stop working, because even going back to earlier versions of the project where the click was recognized does not work anymore. Is there any other way to make window transparency? Follow a print of the program so they can understand what the application is about.

    
asked by anonymous 29.05.2017 / 18:38

1 answer

2

The behavior you describe is as expected, as you can see in documentation :

  When the TransparencyKey property is assigned to Color, the areas of the form that have the same BackColor will be transparently displayed. Any mouse actions, such as the click of the mouse, that are performed in the transparent areas of the form will be transferred to the windows below the transparent area.

Translating

  

When a color is assigned to the TransparencyKey property, areas of the form that have the same background color will be displayed transparently. Any mouse actions, such as a mouse click, that are executed in the transparent area of the form will be transferred to the window behind the transparent area.

In tests I've done here, if I use Red as BackColor and TransparencyKey I have the same behavior that you describe in Windows 10 64-bit, where I have not yet installed the latest update, already in a virtual machine running Windows 7 SP1 it works as described in the documentation.

As a test I changed the color for Magenda and then in my Windows 10 it started to behave as the documentation describes as well.

So I'd say it was some bug that was fixed with the latest Windows 10 update.

    
29.05.2017 / 19:06