FYRe Posted August 23, 2005 Posted August 23, 2005 I am trying to create an event which, when you scroll the mouse wheel UPwards, an event occur, & when you scroll the mouse wheel DOWNwards, an event will occur. Is anyone familiar with using MouseWheel Event, in VS 2003 ? or is there some other Event that can be used? I need example/s or maybe tutorial/s a.s.a.p. for my project. thks, FYRe Quote sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Administrators PlausiblyDamp Posted August 23, 2005 Administrators Posted August 23, 2005 When you use the mouse wheel the MouseWheel event occurs, e.Delta tells you how much the wheel was turned by and the direction is indicated by the sign. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rustyd Posted August 23, 2005 Posted August 23, 2005 Mousewheel event This is from a VS 2002 app. The mousewheel event is not in the list of events but exists (found that on this site). Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel If e.Delta < 0 Then ' Routine when mouse scroll down Else ' Routine when mouse scroll up End If End Sub Quote rustyd
FYRe Posted August 24, 2005 Author Posted August 24, 2005 Mouse Wheel Event/ Rotation This is from a VS 2002 app. The mousewheel event is not in the list of events but exists (found that on this site). Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel If e.Delta < 0 Then ' Routine when mouse scroll down Else ' Routine when mouse scroll up End If End Sub thks... it works! Now I have another query, But how do I know how many "notch" the wheel is rotated? - Each mouse wheel rotation have a notch. - How do I determine how many notches have been turned; both forward and backwards ? :confused: Quote sOMEONE'S gONNA dO iT, wHY nOT yOU ?
rustyd Posted August 24, 2005 Posted August 24, 2005 Add this line of code and the delta value produced by scrolling will appear in your output window. Console.WriteLine("e.delta = " & e.Delta.ToString) Mousewheel forward, or up, e.delta = 120; Mousewheel backward, or down, e.delta = -120; I noticed when I aggressively scrolled the value changed to 240 depending on the direction I scrolled. From scrolling up and down I get the following output: e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -240 e.delta = -120 e.delta = -120 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -240 e.delta = -120 e.delta = -120 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -240 e.delta = -240 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 120 e.delta = 120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = -120 e.delta = 120 e.delta = 120 e.delta = 240 e.delta = 240 e.delta = 240 e.delta = 120 Quote rustyd
FYRe Posted August 24, 2005 Author Posted August 24, 2005 Ok, let me get this clearly, you mentioned that: Mousewheel forward, or up, e.delta = 120; Mousewheel backward, or down, e.delta = -120 does a "Mousewheel forward/backward" means ONE notch of a Mouse Scroll? or generally scrolling the MouseWheel ? Are the statements below TRUE ? Meaning ONE notch forward: e.Delta = 120 TWO notch forward: e.Delta = 240 THREE notch forward: e.Delta = 360 etc... Meaning ONE notch backward: e.Delta = -120 TWO notch backward: e.Delta = -240 THREE notch backward: e.Delta = -360 etc... Quote sOMEONE'S gONNA dO iT, wHY nOT yOU ?
rustyd Posted August 24, 2005 Posted August 24, 2005 I know that up is negative, down is positive. It seems (+/-) 120 is the magic number, but I also occassionaly received (+/-) 240 when I scrolled aggressively. I don't know where you're getting 360. Basically, check for positive or negative to determine the direction of the scroll. Quote rustyd
Afraits Posted August 24, 2005 Posted August 24, 2005 According to ducumentation on MouseWheel event arguments, one mouse wheel click gives a delta of 120 (+ or -), 'aggressive scrolling' may then register more than 1 click between events being raised. Quote Afraits "The avalanche has started, it is too late for the pebbles to vote"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.