Advertisement
kshadow22

Drag A Borderless Form (1) Visual Basic

Jun 29th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim mousedown1 As Boolean = false
  2. Dim a, b As Integer
  3.  
  4.  Private Sub Panel1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseDown
  5.         mousedown1 = True
  6.     End Sub
  7.  
  8. Private Sub Panel1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseUp
  9.         mousedown1 = False
  10.     End Sub
  11.  
  12. Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove
  13.         If mousedown1 = True Then
  14.             Me.Left = Cursor.Position.X - a
  15.             Me.Top = Cursor.Position.Y - b
  16.         End If
  17.     End Sub
  18.  
  19. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  20.         a = Cursor.Position.X - a
  21.         b = Cursor.Position.Y - b
  22.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement