将 DropShadow 添加到自定义窗口(混合) [英] Add DropShadow to a Custom made Window (Blend)

查看:35
本文介绍了将 DropShadow 添加到自定义窗口(混合)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Blend 创建自定义窗口表单.(通过将 AllowTransparency 设置为 True)

I am creating a custom Window form using Blend. (by setting AllowTransparency to True)

我已经完成了设计并且效果很好.现在我想给它添加阴影效果.(DropShadowEffect)

I've finished the design and it works pretty well. Now I want to add Shadow effect to it. (DropShadowEffect)

我不能这样做,因为窗口本身是隐藏的,所以效果不会显示.它不适用于主网格.添加边框并为其添加阴影没有运气.

I can't do that because the Window itself is hidden so the effect won't show. And it doesn't work on the main Grid. No luck with adding a border and give the shadow to it.

推荐答案

好的,我找到了答案.(在此页面的帮助下 )

Ok I found the answer. ( With some help from this page )

首先,将窗口的AllowTransparency 设置为True.然后将它的 Background 更改为 No Brush

First of all, Set the window's AllowTransparency to True. Then change it's Background to No Brush

假设你有这样的东西:(忽略矩形和边框)

Lets say you have something like this: (Ignore the Rectangle and Borders)

然后将网格的 Background 更改为白色.现在点击您的窗口并为其宽度和高度添加大约 15 个像素.

Then change the Grid's Background to White color. Now click on your Window and Add about 15 pixels to its width and height.

并更改阴影设置:

现在你可以看到阴影了:)

Now you can see the shadow :)

我想你知道这是如何工作的.请记住,您仍然可以调整窗口高度/重量和阴影设置以获得更好的效果.

I think you got the idea how this is working. Remember you can still play around with the Window height/weight and the Shadow settings to get a better effect.

这篇关于将 DropShadow 添加到自定义窗口(混合)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆