سلامی مجدد
این کد رو تست کنید . من از جمله بالا منظورتونو متوجه نشدم ، حالا ببینید این بدردتون میخوره
Public Sub MouseDragging(ByVal e As MouseEventArgs, ByVal Control As Control)
Static OldPosition As New Point(-1, -1)
If Not (e.Button = Nothing) Then
If e.Button = Windows.Forms.MouseButtons.Left Then
If (OldPosition.X = -1) And (OldPosition.Y = -1) Then OldPosition = New Point(e.X, e.Y)
If e.Y <> OldPosition.Y Then
Control.Top += e.Y - OldPosition.Y '<span class="highlight">move</span> Up/Down
End If
If e.X <> OldPosition.X Then
Control.Left += e.X - OldPosition.X '<span class="highlight">move</span> Left/Right
End If
End If
Else
'button is nothing, maybe it was lifted.
OldPosition = New Point(-1, -1)
End If
End Sub
این رو هم روی رویداد Mouse_Move بنویسید
MouseDragging(e, Me)
**موفق باشید**