Option Explicit Dim x0 As Single Dim y0 As Single Dim a As Single Dim b As SinglePrivate Sub pic_DragDrop(Source As Control, x As Single, y As Single) Source.Move a + x - x0, b + y - y0 Source.Drag 2 Source.MousePointer = 0 End SubPrivate Sub Pic_Mousedown(Button As Integer, Shift As Integer, x As Single, y As Single) PIC.MousePointer = 99 PIC.Drag 1 x0 = x y0 = y a = PIC.left b = PIC.top End Sub
好像是
getpix
和
setpix
吧。不过我觉得应该还有更检单的方法。
最好能给一段代码
Dim x0 As Single
Dim y0 As Single
Dim a As Single
Dim b As SinglePrivate Sub pic_DragDrop(Source As Control, x As Single, y As Single)
Source.Move a + x - x0, b + y - y0
Source.Drag 2
Source.MousePointer = 0
End SubPrivate Sub Pic_Mousedown(Button As Integer, Shift As Integer, x As Single, y As Single)
PIC.MousePointer = 99
PIC.Drag 1
x0 = x
y0 = y
a = PIC.left
b = PIC.top
End Sub