WinForm 拖动、移动窗体
private const int WM_NCLBUTTONDOWN = 0XA1; private const int HTCAPTION = 2; [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessageA")] private static extern int SendMessage(int hwnd, int wMsg, int wParam, int lParam); [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern int ReleaseCapture(); private void MsgBoxForm_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage((int)this.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); }