1 [DllImport("user32.dll")] 2 public static extern bool ReleaseCapture(); 3 [DllImport("user32.dll")] 4 public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); 5 public const int WM_SYSCOMMAND = 0x0112; 6 public const int SC_MOVE = 0xF010; 7 public const int HTCAPTION = 0x0002; 8 9 private void Form_Login_MouseDown(object sender, MouseEventArgs e) 10 { 11 ReleaseCapture(); 12 SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); 13 }