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

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.