如何把Form1中的command1控件用鼠标拖到Form2中?

解决方案 »

  1.   

    注意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
      

  2.   

    应该可以吧,加上这一句就可以了
            Source.DragMode = 0