输入框自由移动

Dim lx, ly As Int32 '记录鼠标按下时的位置

Private Sub Panel1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown

lx = e.X

ly = e.Y

End Sub

Private Sub Panel1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove

If e.Button = MouseButtons.Left Then

Panel1.Left += e.X - lx

Panel1.Top += e.Y - ly

End If

End Sub

你可能感兴趣的:(输入框自由移动)