using System.Runtime.InteropServices;
[DllImportAttribute("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
[DllImportAttribute("user32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
public static extern int ReleaseCapture();
const int WM_NCLBUTTONDOWN = 0xA1;
const int HTCAPTION = 2;
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
}