简单:
Dim oX, oY
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
oX = X: oY = Y
End SubPrivate Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Image1.Move Image1.Left + X - oX, Image1.Top + Y - oX
End Sub
Dim oX, oY
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
oX = X: oY = Y
End SubPrivate Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button <> 1 Then Exit Sub
Image1.Move Image1.Left + X - oX, Image1.Top + Y - oX
End Sub
的确行,不过怎么鼠标点击一下image就会改变位置,您帮我解决一下
我马上给分
Image1.Left = Image1.Left + (X - oX)
Image1.Top = Image1.Top + (Y - oY)End SubPrivate Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Drag
oX = X
oY = Y
End SubPrivate Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Image1.Left = X - oX
Image1.Top = Y - oY
End Sub
若能对你有所帮助,我将非常高兴!
把Dim oX, oY移到过程外就可以了,前两天我也犯了这个错误,ox,oy是全局变量
TO:hand2001(我爱VB不爱我)
的确行,不过怎么鼠标点击一下image就会改变位置,您帮我解决一下
我马上给分
*****************************************
因该不会有这个问题。
[email protected]
谢谢了