Understanding Transparency Key Transparency Configuration Behavior in C#Form

Asked 1 years ago, Updated 1 years ago, 57 views

Thank you for your help.

I asked about transparent form through Transparency Key before, but it hasn't been resolved yet, so
Let me ask you one more question.

If you set TransparencyKey to Form and transparent the form, the transparent part (the appropriate color part of TransparencyKey) will slip through the form and mouse events will appear on the back. I think I was able to run and operate as if I had a cut-out form.Various
I'm looking at the website and it certainly looks like that.As is the case with the website below.

http://hima-tubusi.blogspot.com/2016/11/c.html

However, if you do the same thing these days, it's apparently transparent, but it slips through the transparent part
You cannot operate on the back.A mouse event occurs while the form remains rectangular to the end.
Yes.

Since when did this specification come into this specification?It's not a defect, it's an official specification
If so, will this specification remain the same from now on?

Personally, I liked it because I was able to do something more interesting before, but I'm a little disappointed.

If anyone knows the details, could you please let me know?

Thank you for your cooperation.

c# form

2022-09-30 11:03

1 Answers

The link I followed from Kunif's comment gave me a complete answer.

Transparent color

this.TransparencyKey=System.Drawing.Color.Magenta;

or

this.TransparencyKey=System.Drawing.Color.Fuchsia;

allows you to mouse-click through the color of the background as desired.

Depending on the color, mouse events do not appear to be transparent.

上記 I have confirmed that the above two colors are transparent.

https://stackoverflow.com/questions/4448771/c-sharp-form-transparencykey-working-different-for-different-colors-why

Also, turning on and off the Aero function in Windows will change this behavior.


2022-09-30 11:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.