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.
精彩评论