C# Form.TransparencyKey working different for different colors, why?

前端 未结 1 643
轮回少年
轮回少年 2020-12-01 18:40

Yesterday I found something very strange (I think). It looks like Form.TransparencyKey gives different results based on which color is used as BackgroundC

相关标签:
1条回答
  • 2020-12-01 19:12

    I've heard of this problem before but never realized it was related to the TransparencyKey choice. Nice find. It is almost certainly caused by Aero. With it disabled, the effect is implemented by use of a hardware overlay in the video adapter. With it enabled, the desktop window compositing feature implements it. You can typically tell by a very brief flash of the transparency color before DWM catches up and replaces the area with the pixels from the windows in the background. Turning DWM off for your window might fix the problem but you'll also lose the glass effects.

    I can see little rhyme or reason to the color value, looks pretty random to me. Hard to call this anything else than a bug. I never ran into this before myself, I always use the same transparency key. Color.Fuchsia, an excellent fuchsed-up color. Recommended.

    0 讨论(0)
提交回复
热议问题