0

I want to load two pictures into an image control at these periods
1. When the mouse is over the image control
2. When the mouse has left the image control

I got this Lines of code (from the net) that work for
mousemove event on Picturebox control but unlucky
for me it deosn't work for Image control.

'If (X < 0) Or (Y < 0) Or (X > Picture1.Width) Or (Y > Picture1.Height) Then ' the MOUSELEAVE pseudo-event
'ReleaseCapture        
'the mouse is gone, so do appropriate stuff
'Picture1.Picture = LoadPicture(App.Path & "\Images\1B.jpg ")
'ElseIf (X > 0) Or (Y > 0) Or (X < Picture1.Width) Or (Y < Picture1.Height) Then ' the MOUSEENTER pseudo-event        
'SetCapture Picture1.hwnd        
'the mouse is over picture box.  do approrpiate stuff
'Picture1.Picture = LoadPicture(App.Path & "\Images\1BB.jpg ")
'End If

Can anyone help me with
Thanks

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by AndreRet
0

Try the following code -

If (X < 0) Or (Y < 0) Or (X > (Image1.Width - 50)) Or (Y > (Image1.Height - 50)) Then
    Image1.Picture = LoadPicture(App.Path & "\1B.jpg")
        Else
    Image1.Picture = LoadPicture(App.Path & "\1BB.jpg")
End If

I have added the "-50" to allow for the mouse movement to be captured BEFORE it leaves the image..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.