Create a fully transparent WPF window to capture mouse events

前端 未结 6 2117
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 08:30

I\'m trying to trap mouse events in WPF by using a topmost, transparent non-modal window. I\'m finding that this works fine if the opacity of the window is 0.01 or greater

6条回答
  •  礼貌的吻别
    2020-12-29 09:13

    For example i think your control name is MyGrid and you want it be Transparent and always get MouseOverEvent.....

    If (window AllowsTransparency is True and the window Background is Transparent) Then

    use a color like #01777777 for MyGrid Background Or 0.01 for MyGrid Opacity.

    Else

    use something like #00777777 for MyGrid Background Or 0.00 for MyGrid Opacity.

提交回复
热议问题