简体   繁体   中英

WPF Remove DropShadow Effect

Right now if I click Button A, Button B shows a DropShadow effect:

 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

If I clicked Button C how would I remove the DropShadow effect from Button B ?

Try it

Me.ButtonB.Effect = Nothing        // VB.Net
this.ButtonB.Effect = null;        // C#
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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM