WPF删除DropShadow效果

时间:2013-07-18 04:33:49

标签: wpf vb.net effect dropshadow

现在,如果我点击按钮A,按钮B会显示一个DropShadow效果:

 Private Sub ButtonA_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ButtonA.Click

 Dim objDropShadow As New DropShadowEffect
            objDropShadow.ShadowDepth = 0
            objDropShadow.BlurRadius = 30
            objDropShadow.Color = Colors.GreenYellow

            Me.ButtonB.Effect = objDropShadow

End Sub

如果单击按钮C,我将如何从按钮B中删除DropShadow效果?

2 个答案:

答案 0 :(得分:4)

试试吧

Me.ButtonB.Effect = Nothing        // VB.Net
this.ButtonB.Effect = null;        // C#

答案 1 :(得分:2)

Private Sub ButtonC_Click(
  ByVal sender As System.Object, 
  ByVal e As System.Windows.RoutedEventArgs) Handles ButtonC.Click

 Dim objDropShadow As New DropShadowEffect
            objDropShadow.ShadowDepth = 0
            objDropShadow.BlurRadius = 0
            objDropShadow.Color = Colors.Transparent

            Me.ButtonB.Effect = objDropShadow

End Sub