开发者

How to set transparency color of the WPF Window?

Is there any way to set one specific color to be开发者_开发知识库 transparent for the whole WPF window?


You don't need to. Transparency in WPF doesn't work using mask colors like in Winforms- just set the background to Transparent, and AllowsTransparency to true. If you want different shaped windows, you can use the technique described here: http://devintelligence.com/2007/10/shaped-windows-in-wpf/


We can make a transparent WPF window by using a XAML like follows.

<Window x:Class="SeeThru.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SeeThru" Height="300" Width="300"
    WindowStyle="None" AllowsTransparency="True"
    Background="Transparent">
......
</Window>


No. WPF supports alpha-channel transparency, not bitmap mask transparency.

There are people who have attempted to work around this, but only on a per-image basis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜