-
How do I make it so when the mouse goes over an Image code is activated? I tried MouseMove, but that only works when you move the mouse over something - I need it so if a mouse is on an Image it activates the code, whether it's moving or not.
Thanks.
-Git
-
Well you can't do that. You only have the MouseMove Event to work with. However, this works very well in every instance i've ever had aneed for such a thing. Perhaps if you explain what it is you are trying to do i could come up with an alternitive.
-
Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Type PointAPI
X as Long
Y as Long
End Type
Private lLeft as long, lTop as Long,
Private MyPoints as PointAPI
Form_Load
lLeft = Picture1.Left + Form1.Left
lTop = Picture1.top + Form1.Top
end sub
Private Sub Picture1_MouseMove(...)
Timer1.Enabled = True
Timer2.Enabled = True
End Sub
Private Sub Timer1_Timer()
'Your code here
End Sub
Private Sub Timer2_Timer()
GetMouseXY MyPoints
'See if the Cursor is still over the picture
If (MyPoints.X < lLeft) OR (MyPoints.X > (lLeft + Picture1.Width)) OR (MyPoints.Y < lTop OR MyPoints.Y > (lTop + Picture1.Height)) Then
Timer1.Enabled = False
Timer2.Enabled = False
'Basicly, This checks every side of the Picturebox and makes sure the mouse is still on the inside of the box
End Sub
I think this will work, Let me know if you have any problems