15-11-12, 01:57 PM
السلام عليكم،
إليك هذا الكود لتحريك Form1 عن طريق Panel1
إليك هذا الكود لتحريك Form1 عن طريق Panel1
كود :
Public Class Form1
Private canMove As Boolean = False
Private mousePT As Point
Private Sub Panel1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
mousePT = Me.Location - Cursor.Position
canMove = True
End Sub
Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
If canMove Then
Me.Location = Cursor.Position + mousePT
End If
End Sub
Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
canMove = False
End Sub
End Class
