Re: Reversing changes made by mousemove event

Tech-Archive recommends: Fix windows errors by optimizing your registry



Ok. It is working with one label. I have a label control so this is how I
modifed it. It doesn't work with the control array of labels.

Private Sub Label2_DragDrop(Index As Integer, Source As Control, X As
Single, Y As Single)
If Source Is Label2(Index) Then
Label2(Index).Drag vbEndDrag
MsgBox "Clicked"
End If
End Sub

Private Sub Label2_DragOver(Index As Integer, Source As Control, X As
Single, Y As Single, State As Integer)
If (State = vbLeave) And (Source Is Label2(Index)) Then
Label2(Index).Drag vbEndDrag
End If
End Sub

Private Sub Label2_MouseMove(Index As Integer, Button As Integer, Shift As
Integer, X As Single, Y As Single)
Label2(Index).DragIcon = Me.Icon ' Use whatever pointer you want shown
Label2(Index).Drag vbBeginDrag
End Sub

--

Thanks.


"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote in
message news:OjuaPRDCIHA.536@xxxxxxxxxxxxxxxxxxxxxxx
Start a new project, add a Label control to the form somewhere and
copy/paste Larry's code into the code window. Then run the project and
move the mouse around watching the cursors shape as it moves in and out of
the Label's area... I think you will be surprised. Larry's code is letting
the built-in Windows drag "alert" mechanism handle the icon changes as the
mouse is moved in and out of the Label's boundary.

Rick


"Saucer Man" <saucerman@xxxxxxxxxx> wrote in message
news:lWNNi.1327$Qa.928@xxxxxxxxxxxxxxxxxxxxxxxxx
I'm confused with this. This is dragging the labels. I just want to
make them appear as link. What am I missing?

--

Thanks.


"Larry Serflaten" <serflaten@xxxxxxxxxxxxxx> wrote in message
news:efZDu%23ACIHA.464@xxxxxxxxxxxxxxxxxxxxxxx

"Saucer Man" <saucerman@xxxxxxxxxx> wrote

When I move the mouse off of the labels I want to reverse the changes
but I
am getting unstable results. Sometimes the changes reverse sometimes
they
don't. Here is what I have.

One of the problems is sometimes I can move from one of the popped up
menus
to another label without going over the image control. Is there a
better
way to do this?

If you are not supporting keyboard input, (mouse only) then this method
can work well. If you plan to support keyboard input, then expect
keyboard
input to be interrupted while the mouse is over a label. (or use
another
method....)

LFS

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Label1.DragIcon = Me.Icon ' Use whatever pointer you want shown
Label1.Drag vbBeginDrag
End Sub

Private Sub Label1_DragDrop(Source As Control, X As Single, Y As Single)
If Source Is Label1 Then
Label1.Drag vbEndDrag
MsgBox "Clicked"
End If
End Sub

Private Sub Label1_DragOver(Source As Control, X As Single, Y As Single,
State As Integer)
If (State = vbLeave) And (Source Is Label1) Then
Label1.Drag vbEndDrag
End If
End Sub








.


Quantcast