2012-05-16 4 views
1

У меня есть код для применения DropShadowBitmapEffect к UserControl.BitmapEffect заменить на эффекты

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 

ответ

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

Смежные вопросы