Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. public const int WM_NCLBUTTONDOWN = 0xA1;
  2. public const int HT_CAPTION = 0x2;
  3.  
  4. [System.Runtime.InteropServices.DllImport("user32.dll")]
  5. public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
  6. [System.Runtime.InteropServices.DllImport("user32.dll")]
  7. public static extern bool ReleaseCapture();
  8.  
  9. private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
  10. {
  11.     if (e.Button == MouseButtons.Left)
  12.     {
  13.         ReleaseCapture();
  14.         SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement