The MouseWheel event fires when the user scrolls the mouse wheel. This tutorial shows how to get a positive or negative number from the MouseWheelEventArgs to determine what direction the wheel is moving.
- [Instructor] For this example application…I have an image transition application.…Right now we're looking at this picture…of some food and a pretzel on the screen.…I'll take my mouse and use the mouse wheel…and eventually the pretzel picture disappears…and this picture of a pastry appears.…If I locate my mouse the opposite direction,…we return through a transition back to the original picture.…In the upper left hand corner, I have a number up here…that represents the opacity level of the picture,…in this case the pretzel picture.…That's as useful for you and me,…your users could probably care less…about having an opacity value there,…but it helps us see what's happening.…
Watch this again as I rotate my mouse wheel.…When it gets to zero I know that the opacity level…of the pretzel picture is zero, which means its invisible.…And that means that this pastry picture is set at one.…And when I move my mouse in the other direction,…it goes back up to one.…Since I'm using a numeric input from my mouse wheel,…the way I write my event handler for my code…
- Understanding routed events and event signatures
- Wiring up event handlers
- Event bubbling and tunneling
- Programming mouse events
- Programming keyboard and ink events