添加 Image1 Label1 Picture1自己慢慢去体会吧 Option Explicit Dim MouseX%, MouseY%Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single) Image1.Left = X - MouseX: Image1.Top = Y - MouseY End SubPrivate Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then MouseX = X: MouseY = Y Label1.Move Image1.Left, Image1.Top + Y - Image1.Height / 2, Image1.Width, Image1.Height Label1.Drag End If End SubPrivate Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer) If State = 0 Then Source.MousePointer = 5 If State = 1 Then Source.MousePointer = 0 End SubPrivate Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single) Picture1.PaintPicture Image1.Picture, X - MouseX, Y - MouseY, Image1.Width, Image1.Height End Sub
Option Explicit
Dim MouseX%, MouseY%Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Image1.Left = X - MouseX: Image1.Top = Y - MouseY
End SubPrivate Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
MouseX = X: MouseY = Y
Label1.Move Image1.Left, Image1.Top + Y - Image1.Height / 2, Image1.Width, Image1.Height
Label1.Drag
End If
End SubPrivate Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
If State = 0 Then Source.MousePointer = 5
If State = 1 Then Source.MousePointer = 0
End SubPrivate Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Picture1.PaintPicture Image1.Picture, X - MouseX, Y - MouseY, Image1.Width, Image1.Height
End Sub