jflanner
asked on
Need MouseEnter to work when left mouse is down
Hello Folks:
I have an event handler for Mouse Enter events. It's pretty generic.
Private Sub textboxBoggleDie00_MouseEn ter(ByVal pSender As Object, ByVal e As System.EventArgs) _
Handles textboxDie00.MouseEnter, _
textboxDie01.MouseEnter, _
textboxDie02.MouseEnter
Dim Sender As Integer
If LeftMouseDown Then
Sender = Me.DieIndex(pSender.Name)
Me.MouseEvent(Sender)
Else
End If
End Sub
This works great if no mouse buttin is down as the mouse moves along. But if the mouse is moved with the left mouse buttoin down, I never get control.
How can I get the mouse enter event to work with buttons down?
I have an event handler for Mouse Enter events. It's pretty generic.
Private Sub textboxBoggleDie00_MouseEn
Handles textboxDie00.MouseEnter, _
textboxDie01.MouseEnter, _
textboxDie02.MouseEnter
Dim Sender As Integer
If LeftMouseDown Then
Sender = Me.DieIndex(pSender.Name)
Me.MouseEvent(Sender)
Else
End If
End Sub
This works great if no mouse buttin is down as the mouse moves along. But if the mouse is moved with the left mouse buttoin down, I never get control.
How can I get the mouse enter event to work with buttons down?
ASKER
Hi Idle Mind:
This did not do the trick. It behaves just as the MouseEnter did. That is, I get control if the mouse moves within a textbox, and both mouse buttons are up. I do not get control if either mouse button is down.
One weird thing - I do get control if I move around in the same control I left downed in. But if I left down in another control, and move into the control with left mouse down, I do not get control. (I prove this in the code below by setting a break point on the statement Sender = Me.DieIndex(pSender.Name). Notice the IF structure I have surroinded htis with.)
My goal is to get control if the mouse enters the testbox while the mouse button is depressed.
My code is below. Any more iseas???
Private Sub MouseMove(ByVal pSender As Object, ByVal e As System.Windows.Forms.Mouse EventArgs) _
Handles textboxBoggleDie00.MouseMo ve, _
textboxBoggleDie01.MouseMo ve, _
textboxBoggleDie02.MouseMo ve, _
textboxBoggleDie03.MouseMo ve, _
textboxBoggleDie10.MouseMo ve, _
textboxBoggleDie11.MouseMo ve, _
textboxBoggleDie12.MouseMo ve, _
textboxBoggleDie13.MouseMo ve, _
textboxBoggleDie20.MouseMo ve, _
textboxBoggleDie21.MouseMo ve, _
textboxBoggleDie22.MouseMo ve, _
textboxBoggleDie23.MouseMo ve, _
textboxBoggleDie30.MouseMo ve, _
textboxBoggleDie31.MouseMo ve, _
textboxBoggleDie32.MouseMo ve, _
textboxBoggleDie33.MouseMo ve
Dim Sender As Integer
If e.Button = MouseButtons.Left Then
'GARBAGE IF: limit to textboxBoggleDie00 for debugging
If pSender.Name = "textboxBoggleDie00" Then
'BREAK POINT SET HERE.
Sender = Me.DieIndex(pSender.Name)
Me.MouseEvent(Sender)
Else
End If
Else
End If
End Sub
This did not do the trick. It behaves just as the MouseEnter did. That is, I get control if the mouse moves within a textbox, and both mouse buttons are up. I do not get control if either mouse button is down.
One weird thing - I do get control if I move around in the same control I left downed in. But if I left down in another control, and move into the control with left mouse down, I do not get control. (I prove this in the code below by setting a break point on the statement Sender = Me.DieIndex(pSender.Name).
My goal is to get control if the mouse enters the testbox while the mouse button is depressed.
My code is below. Any more iseas???
Private Sub MouseMove(ByVal pSender As Object, ByVal e As System.Windows.Forms.Mouse
Handles textboxBoggleDie00.MouseMo
textboxBoggleDie01.MouseMo
textboxBoggleDie02.MouseMo
textboxBoggleDie03.MouseMo
textboxBoggleDie10.MouseMo
textboxBoggleDie11.MouseMo
textboxBoggleDie12.MouseMo
textboxBoggleDie13.MouseMo
textboxBoggleDie20.MouseMo
textboxBoggleDie21.MouseMo
textboxBoggleDie22.MouseMo
textboxBoggleDie23.MouseMo
textboxBoggleDie30.MouseMo
textboxBoggleDie31.MouseMo
textboxBoggleDie32.MouseMo
textboxBoggleDie33.MouseMo
Dim Sender As Integer
If e.Button = MouseButtons.Left Then
'GARBAGE IF: limit to textboxBoggleDie00 for debugging
If pSender.Name = "textboxBoggleDie00" Then
'BREAK POINT SET HERE.
Sender = Me.DieIndex(pSender.Name)
Me.MouseEvent(Sender)
Else
End If
Else
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.Mouse
If e.Button = MouseButtons.Left Then
' mouse has moved in control while the left button was down
End If
End Sub
~IM