注意form1上面有一个command1 command1的DropMode = 1 - AutomaticOption Explicit Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Form_DragDrop(Source As Control, X As Single, Y As Single) If Source = Form1.Command1 Then SetParent Source.hWnd, Form2.hWnd Source.Left = X Source.Top = Y End If End Sub
command1的DropMode = 1 - AutomaticOption Explicit
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
If Source = Form1.Command1 Then
SetParent Source.hWnd, Form2.hWnd
Source.Left = X
Source.Top = Y
End If
End Sub
Source.DragMode = 0