Live Chat Icon For mobile
Live Chat Icon

How can I move a Borderless form?

Platform: WinForms| Category: Form

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

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HTCAPTION = 0x2;
public static extern bool ReleaseCapture();
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)
		SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.