明次 发表于 2009-4-6 12:09

vb 鼠标拖动image

Dim bx, by As Long
Dim Startmove As Boolean

Private Sub image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then bx = X: by = Y: Startmove = True
End Sub

Private Sub image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Startmove Then
Image1.Move Image1.Left + X - bx, Image1.Top + Y - by
End If
End Sub

Private Sub image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then Startmove = False
End Sub

明次 发表于 2009-4-6 12:50

沙发没人坐我自己坐
页: [1]
查看完整版本: vb 鼠标拖动image