WPF中TransparencyKey的等效性

时间:2011-09-06 22:01:38

标签: c# wpf

在Win Form中,我们可以通过创建具有蓝色背景颜色的位图来创建非矩形表单。因此,我们可以将其设置为Win Form的背景图像,并将TransparencyKey选项更改为蓝色,我们有一个形状窗口。

所以,我的问题是What is the equivalency to TransparencyKey in WPF that does like Win Form's TransparencyKey?

感谢您的关注:)

2 个答案:

答案 0 :(得分:2)

没有等价物 只需使用包含透明区域的图像(因此必须是PNG或GIF),将WindowStyle设置为None,将窗口背景设置为Transparent,然后设置AllowTransparency到真。

透明区域无法点击。

答案 1 :(得分:0)

将AllowTransparency设置为true,然后对wpf使用像素着色器效果库。 使用此链接可获取有关如何使用像素着色器的更多详细信息:Green screen in wpf