kshadow22

Drag A Borderless Form Visual Basic

Jun 29th, 2015
123
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (pnlCaption is the same as a Panel1.)
  2. This is to drag a borderless form
  3.  
  4. Private Sub pnlCaption_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pnlCaption.MouseDown
  5.         If e.Button = Windows.Forms.MouseButtons.Left And Me.WindowState <> FormWindowState.Maximized Then
  6.             MoveForm()
  7.         End If
  8.     End Sub
  9.  
  10.     Private Sub MoveForm()
  11.         ReleaseCapture()
  12.         SendMessage(Me.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0)
  13.     End Sub
RAW Paste Data