George Shepherd's Windows Forms FAQ
Questions and answers in this FAQ have been collected from newsgroup posts, various mailing lists and the employees of Syncfusion.

32.19 How can I move a Borderless form?


This code snippet shows how you can move a borderless form.

[C#]
public const int WM_NCLBUTTONDOWN = 0xA1;
public 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, System.Windows.Forms.MouseEventArgs e)
{
     if (e.Button == MouseButtons.Left)
     {
          ReleaseCapture();
          SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
     }
}



Windows Forms-Form

© 2001-2009 Copyright Syncfusion Inc. All rights reserved.  |  Privacy Policy  |  Contact  |  Sitemap