WPF Window Transparency (including Non

Is there any way to make a WPF window transparent without losing the non-client area (borders, title bar, close/minimise/maximise buttons)?

Setting 'AllowsTransparency' to 'true' requires that 'WindowStyle' be set to 'None' (as explained in this answer), which removes the non-client area.

One of the WPF developers blogged about how transparent windows work in WPF, and why it would have been difficult to implement support for non-client area transparency.

No matter what your window styles may suggest, transparent WPF windows do not have any visible non-client area. This is fine for many scenarios where the intent is to create a custom window shape, but it can be annoying for people who just want to "fade in" a normal window.

A WPF-only solution, then, seems out of the question.

Calling the native SetLayeredWindowAttributes function and passing a WPF window's handle and LWA_ALPHA has no effect, as expected.

The only other approach I can think of is hosting WPF content within a Win32 (or possibly WinForms) window. I suspect trying to do this will result in airspace issues, however.

WPF layered windows have different capabilities on different operating systems ... WPF does not support transparency color keys, because WPF cannot guarantee to render the exact color you requested, particularly when rendering is hardware-accelerated.

I'm not sure if I'm reading the above correctly, but it sounds like trying to host WPF content featuring transparency is not possible.

Any ideas?

透明的Notepad2窗口


流体套件有一个玻璃窗口,我认为这是你在追求的东西。


You can customize non-client area using library from ms called WPF Chrome. Check this article: 'Custom Window Chrome'.

With this library you can make chrome transparent and change many more things.

链接地址: http://www.djcxy.com/p/4412.html

上一篇: 在vim中增加搜索的Emacs风格突出显示

下一篇: WPF窗口透明度(包括非