1

我有一些代码可以应用于DropShadowBitmapEffectUserControl。

Visual Studio 表示this.BitmapEffect弃用,我们必须使用Effects.

那应该怎么做呢?

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
4

1 回答 1

2
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

于 2012-05-16T12:19:06.540 回答