Private Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim bMouseOn As Boolean
bMouseOn = (0 <= X) And (X <= Picture1.Width) And (0 <= Y) And (Y <= Picture1.Height)
If bMouseOn Then
Picture1.Tag = "ON"
Call SetCapture(Picture1.hWnd) '虏获鼠标事件
Else
Picture1.Tag = "EXIT"
Call ReleaseCapture
End If
With Picture1
If Picture1.Tag = "ON" Then ' 鼠标放上去
'ImageList1的第1个图片是 鼠标放上去的图片
Picture1.Picture = ImageList1.ListImages.Item(1)
Else ' 鼠标移开
'恢复原来的图片
Picture1.Picture = ImageList1.ListImages.Item(0)
End If
End With
End Sub