1

EDIT: Using Color.FromArgb(31,31,32) for the BackColor instead of Color.FromArgb(32,32,32) fixed it... I hate windows sometimes.

I have a program that has the background set to be transparent with a TransparencyKey, and whenever you click on any transparent areas, the click goes through the window and onto anything behind it. This is unwanted behaviour, and every solution I've found doesn't work. This problem only needs to be fixed on Windows 11 (22000+) so if it's specific to that it's fine.

I've tried the answer here and the 2 linked questions, and I tried translating this VB.NET code but neither did anything.

Kran
  • 19
  • 5
  • In winforms the color (named or random) did make that difference but i know nothing about net-core.. – TaW Mar 31 '22 at 06:25
  • Have you tried `Color.Red` for background and transparency key? – Reza Aghaei Mar 31 '22 at 06:48
  • You can use a Per-pixel Alpha Layered Form, generating an Image which is almost transparent (e.g., clear with `Color.FromArgb(1, 1, 1, 1)`). You get mouse events since the Window is not click-through in the area where the Bitmap is drawn. @RezaAghaei can show you how to build that. -- You can overlay a standard Form with Transparency key set, if necessary. Or use the old trick, the Big Buffer from Screen. – Jimi Mar 31 '22 at 06:57
  • Of course you could also *import* a WPF Window and set something like `AllowsTransparency="True" Background="#02010101"`. The effect is similar. – Jimi Mar 31 '22 at 07:20
  • @RezaAghaei I've tried using `Color.DarkGray` and nothing changed, `Color.Red` would look weird because I use GDI to draw over it with antialiasing. (Currently I use `Color.FromArgb(32, 32, 32)`) – Kran Mar 31 '22 at 16:42

0 Answers0