بسم الله الرحمن الرحيم
السلام عليكم ورحمة الله وبركاته
اليوم سأشرح لكم طريقة جعل الـ Panel في vb.net قابل للسحب والتحريك
قم بوضع الكود التالي داخل الفورم
Private MouseIsDown As Boolean = False
Private MouseIsDownLoc As Point = Nothing
Private Sub Panel_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel.MouseMove
If e.Button = MouseButtons.Left Then
If MouseIsDown = False Then
MouseIsDown = True
MouseIsDownLoc = New Point(e.X, e.Y)
End If
Me.Location = New Point(Me.Location.X + e.X - MouseIsDownLoc.X, Me.Location.Y + e.Y - MouseIsDownLoc.Y)
End If
End Sub
Private Sub Panel_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Panel.MouseUp
MouseIsDown = False
End Sub
مع تبديل Panel بإسم الـ Panel الخاص بك والمرغوب تحويله إلى نقطه تحريك
كرر العملية في حال كنت تريد تحريك أكثر من بانل
