混合3效果/投影 [英] Blend 3 Effects/Drop Shadow

查看:79
本文介绍了混合3效果/投影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以通过设置C#代码中的事件来应用或至少切换Blend中可用的阴影效果。我需要根据后面代码中的一些事件来切换这种效果。我知道如何通过控件模板来完成这些类型的事情,但这不是我想要做的。我需要通过C#来做到这一点。这可能吗?谢谢!

Hi, I was wondering if it was possible to apply, or at least toggle the drop shadow effect that is available in Blend, by setting events in the C# code behind. I need to toggle this effects based upon some events in the code behind. I know how to do these types of things through control templates, but this is not what I am trying to do. I NEED to do this through the C#. Is this possible? Thanks!

推荐答案

这是一个非常简单的解决方法。假设您正在使用网格进行布局,请将应用了投影的控件副本放在与原始相同的单元格中并折叠它。每当你想要投影,将可见性切换到可见和ta-da时,你就会有一个阴影。

如果你知道你要添加阴影的大小和形状它也更容易,你也可以获得一些性能。而不是重复控件,只需在photoshop中制作投影并将其保存为具有透明度的png。在鼠标悬停(或其他)上,将其切换为可见。我使用这个技巧和飞出菜单,并且png制作了非常波动的动画黄油光滑。

There's a really easy workaround for this. Assuming you're using a grid for layout, put a copy of your control with the drop shadow applied in the same cell as the original and collapse it. Whenever you want the drop shadow, toggle the visibility to visible and ta-da, you have a drop shadow.

If you know the size and shape of what you're going to be adding a drop shadow too, it's even easier and you can gain some performance as well. Instead of duping the control, just make a drop shadow in photoshop and save it out as a png with transparency. On mouseover (or whatever), toggle it to visible. I used this trick with a fly-out menu, and the png made what was extremely choppy animation buttery-smooth.


这篇关于混合3效果/投影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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