Option ExplicitPrivate Declare Function SetCapture Lib "user32" (ByVal hWnd As Long) As LongPrivate Sub picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) With Picture1 SetCapture .hWnd If X > 0 And X < .Width And Y > 0 And Y < .Height Then .Picture = LoadPicture("c:\test.bmp") .BackColor = vbRed Else SetCapture 0 .BackColor = vbBlue .Picture = LoadPicture("c:\a.bmp") End If End With End Sub
Dim b As BooleanPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Not b Then Picture1.Picture = Picture2.Picture b = True End If
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If b Then Picture1.Picture = Picture3.Picture b = False End If
With Picture1
SetCapture .hWnd
If X > 0 And X < .Width And Y > 0 And Y < .Height Then
.Picture = LoadPicture("c:\test.bmp")
.BackColor = vbRed
Else
SetCapture 0
.BackColor = vbBlue
.Picture = LoadPicture("c:\a.bmp")
End If
End With
End Sub
If Not b Then
Picture1.Picture = Picture2.Picture
b = True
End If
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If b Then
Picture1.Picture = Picture3.Picture
b = False
End If
End Sub