Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Posted

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

rustyd
Posted

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:

sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Posted

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

rustyd
Posted

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...

sOMEONE'S gONNA dO iT, wHY nOT yOU ?
Posted

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.

rustyd
Posted
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.

Afraits

"The avalanche has started, it is too late for the pebbles to vote"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...