返回列表 發帖

滑鼠指標移入移出

Private Sub Picture2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    SetCapture (Picture2.hWnd)
    '↑當滑鼠指標移入Picture1時,將Picture1.MouseMove設為獨佔滑鼠指標。

    If Button = 1 Then Picture2.Picture = Picture3 Else Picture2.Picture = Picture3
    '↑當滑鼠在Picture1按下左鍵時,將Picture1變成按下圖形()Image2,若無則換成浮起圖形(Image1)。

    If X < 0 Or Y < 0 Or X > Picture2.Width Or Y > Picture2.Height Then Call ReleaseCapture: Picture2.Picture = Picture4
    '↑當滑鼠指標移出Picture1時,將釋放Picture1.MouseMove所獨佔滑鼠指標,將圖形換成普通圖形。
End Sub

返回列表