Window transparency in WPF and Winforms

Why do I need to set a property WindowStylein Nonea WPF form in order to get transparency, but in Winforms I can do it in any form and save borders, standard buttons, etc.? Obviously, the API supports this, so I don’t quite understand what is especially important in WPF that would make this problem.

I assume that WPF skips over some DirectX or OpenGL hoops, while Winforms just sets the alpha for the window through the API, but I could be outside the base.

+3
source share
1 answer

I agree, it's hard:

   private void VerifyConsistencyWithAllowsTransparency(WindowStyle style)
   {
       if (AllowsTransparency && style != WindowStyle.None)
       {
           throw new InvalidOperationException(SR.Get(SRID.MustUseWindowStyleNone));
       }
   }

WPF Windows Forms, . , WPF. , Window.cs, . UsesPerPixelOpacity:

, . , UsesPerPixelOpacity - , , , . /

" ", .

+2

Source: https://habr.com/ru/post/1758416/


All Articles