Hi,
I was just trying to make this program for the fun of it... and I wanted to add a clickwheel control to it.
I am trying to detect the motions by dividing the UserControl (i.e the Clickwheel) into four quarters and there will be two types of motions per quarter. However, for some reason wherever I move the mouse over the UserControl, it always goes to the third If condition (Top Left Quarter)... I am using the following code... if someone can help me.. I would really appreciate it...
VB Code:
Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static intX As Integer
Static intY As Integer
If X > frmMain.linSeperator.X1 Then
If Y < frmMain.linHSeperator.Y1 Then
' "Going Down The List"
frmMain.Label1.Caption = "1 " & X & " " & Y
If X > intX And Y > intY Then Call ScrollAdd
' "Going Up The List"
If X < intX And Y < intY Then Call ScrollSubtract
End If
If Y > frmMain.linHSeperator.Y1 Then
frmMain.Label1.Caption = "2 " & X & " " & Y
' "Going Up The List"
If X > intX And Y < intY Then Call ScrollAdd
' "Going Down The List"
If X < intX And Y > intY Then Call ScrollSubtract
End If
End If
If X < frmMain.linSeperator.X1 Then
If Y < frmMain.linSeperator.Y1 Then
frmMain.Label1.Caption = "3 " & X & " " & Y
' "Going Down The List"
If X > intX And Y < intY Then Call ScrollAdd
' "Going Up The List"
If X < intX And Y > intY Then Call ScrollSubtract
End If
If Y > frmMain.linSeperator.Y1 Then
frmMain.Label1.Caption = "4 " & X & " " & Y
' "Going Up The List"
If X > intX And Y > intY Then Call ScrollSubtract
' "Going Down The List"
If X < intX And Y < intY Then Call ScrollAdd
End If
End If
intX = X
intY = Y
If you want to take a look at the project... I have attached it... I have just begun... so it isn't that great...
Any help would be appreciated.
Khanjan
Hey... If you found this post helpful please rate it.
Can't check it, since I'm at work, but what are intX and intY for?
They are locally declared as Static, and you set them at the end of the sub? What should their value be before, remember you use them in the If -clauses!
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button Wait, I'm too old to hurry!
intX and intY are for storing the previous co-ordinates. So I can match the current X and Y co-ordinates of the mouse and figure out in which direction the mouse is moving...
Hope that helps
Rob I will be trying your suggestion and I will reply to inform if it works or not.
Thank you,
Khanjan
Hey... If you found this post helpful please rate it.