This code snippet shows how you can move a borderless form.
private const int WM_NCLBUTTONDOWN = 0xA1;
private const int HTCAPTION = 0x2;
[ DllImport( "user32.dll" ) ]
public static extern bool ReleaseCapture();
[ DllImport( "user32.dll" ) ]
public static extern int SendMessage( IntPtr hWnd, int Msg, int wParam, int lParam );
private void Form1_MouseDown( object sender, MouseEventArgs e )
{
if ( e.Button == MouseButtons.Left )
{
ReleaseCapture();
SendMessage( Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0 );
}
}
Contributed from George Shepherd's Windows Forms FAQ