Results 1 to 3 of 3

Thread: Easy simple little question.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Posts
    225
    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

  2. #2
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336

    Wink

    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.
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  3. #3
    Lively Member
    Join Date
    Nov 1999
    Location
    Cincinnati, OH
    Posts
    66
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width