private const int WM_NCLBUTTONDOWN = 0x00A1;
private const int HTCAPTION = 2;
[DllImport("", CharSet = )]
public static extern IntPtr SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("", CharSet = )]
public static extern bool ReleaseCapture();
protected override void OnMouseDown( MouseEventArgs e )
{
( e );
if ( == ) // The left mouse button is pressed
{
ReleaseCapture(); // Release Capture
SendMessage(, WM_NCLBUTTONDOWN, (IntPtr)HTCAPTION, ); // Drag the form
}
}