首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用效应代替BitmapEffect

用效应代替BitmapEffect
EN

Stack Overflow用户
提问于 2012-05-16 12:14:24
回答 1查看 1.4K关注 0票数 1

我有一些代码可以将DropShadowBitmapEffect应用于UserControl。

Visual说this.BitmapEffect废弃的,我们必须使用Effects

那麽应该怎样做呢?

代码语言:javascript
复制
DropShadowBitmapEffect myDropShadowEffect = new DropShadowBitmapEffect();
myDropShadowEffect.Color = GetShadowColorValue();
myDropShadowEffect.Direction = 250;
// Set the depth of the shadow being cast.
myDropShadowEffect.ShadowDepth = 0;
// Set the shadow softness to the maximum (range of 0-1).
myDropShadowEffect.Softness = 1;
// Set the shadow opacity to half opaque or in other words - half transparent.
// The range is 0-1.
myDropShadowEffect.Opacity = 0.7;
// Apply the bitmap effect to the Button.
this.BitmapEffect = myDropShadowEffect; // BitmapEffect is deprecated
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-16 12:19:06

代码语言:javascript
复制
DropShadowEffect myDropShadowEffect = new DropShadowEffect();

myDropShadowEffect.Color = GetShadowColorValue();
myDropShadowEffect.Direction = 250;

// Set the depth of the shadow being cast.
myDropShadowEffect.ShadowDepth = 0;

// Set the shadow softness to the maximum (range of 0-1).
// myDropShadowEffect.Softness = 1;

// Set the shadow opacity to half opaque or in other words - half transparent.
// The range is 0-1.
myDropShadowEffect.Opacity = 0.7;

// Apply the effect to the Button.
this.Effect = myDropShadowEffect;

我不知道什么是Softness.您可以尝试调整BlurRadius值。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10618291

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档