Using MouseMove 
Author Message
 Using MouseMove

Hey guys, I am having trouble setting up MouseMove stuff.  I simply want to
cause an event when the mouse pointer is over a certain command button.  I
don't really understand how I determine where the pointer is in relation to
the button.  Here is some of the code that I tried, but as I'm sure some of
you will see imediately, it doesn't work.

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)

cmdInvLeft = cmdInv.Left
cmdInvTop = cmdInv.Top

If (X > (frmHardware.top + cmdInvLeft) And X < (frmHardware.top +
(cmdInvLeft + cmdInv.height))) Then
    If (Y > (frmHardware.left+ cmdInv.left) And Y < (frmHardware.left +
(cmdInv.left + cmdInv.width))) Then
        Image2.Picture = LoadPicture("imgNotice.bmp")
    End If
End If
End If

End Sub

Thanks for any help

Gordy



Mon, 27 Sep 2004 09:19:15 GMT  
 Using MouseMove
Load your picture in the command button's MouseMove event, not the Form's
MouseMove.

Lee Weiner
lee AT leeweiner DOT org


Quote:

>Hey guys, I am having trouble setting up MouseMove stuff.  I simply want to
>cause an event when the mouse pointer is over a certain command button.  I
>don't really understand how I determine where the pointer is in relation to
>the button.  Here is some of the code that I tried, but as I'm sure some of
>you will see imediately, it doesn't work.

>Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single,
>Y As Single)

>cmdInvLeft = cmdInv.Left
>cmdInvTop = cmdInv.Top

>If (X > (frmHardware.top + cmdInvLeft) And X < (frmHardware.top +
>(cmdInvLeft + cmdInv.height))) Then
>    If (Y > (frmHardware.left+ cmdInv.left) And Y < (frmHardware.left +
>(cmdInv.left + cmdInv.width))) Then
>        Image2.Picture = LoadPicture("imgNotice.bmp")
>    End If
>End If
>End If

>End Sub

>Thanks for any help

>Gordy



Mon, 27 Sep 2004 09:32:32 GMT  
 Using MouseMove

Quote:

> Hey guys, I am having trouble setting up MouseMove stuff.  I simply want
to
> cause an event when the mouse pointer is over a certain command button.
> [...]
> Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As

Single,

Use the MouseMove event for the button, not for the form, i.e. Private Sub
Command1_MouseMove.

Eq.

--

Equinox Tetrachloride
www.cl4.org - www.insecurities.org



Mon, 27 Sep 2004 10:17:03 GMT  
 Using MouseMove

Quote:
> Load your picture in the command button's MouseMove event, not the Form's

Thanks, that did the trick:)

Gordy



Mon, 27 Sep 2004 11:08:00 GMT  
 Using MouseMove
also the X and Y returned by Mousemove are *NOT* the x and y position of the mouse on the screen,
its in relation to the object_MouseMove's top and left...

although moving over the command button will not even trigger form_mousemove, if you wanted to
detect it in the way you ddi, all you need to do is use if x > cmdInv.Left, as using Form.Left will
result in a very high value for "form.left + cmdinv.left" as form.left and form.top are measured in
twips, and also , like i said, mousemove takes into account the form's cursor offset...


Quote:

> > Load your picture in the command button's MouseMove event, not the Form's

> Thanks, that did the trick:)

> Gordy



Tue, 28 Sep 2004 03:39:57 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Using MouseMove

2. Using 'whereis' in the mousemove event

3. Possible to detect mousemove over commandbars/toolbars ?

4. Implementing Multipage MouseMove Event

5. mousemove event axWebBrowser

6. PictureBox doesn't receive mousemove message?

7. Mousemove over a panel question.

8. MouseMove event not fired for forms with IsMdiContainer = true

9. mousemove event vb6 to vb.net

10. Speedup event mousemove

11. MouseMove Events

12. Command button color and mousemove

 

 
Powered by phpBB® Forum Software