visual studio make form draggable code example
Example: drag form in C# winform
[DllImport("user32")]
private static extern bool ReleaseCapture();
[DllImport("user32")]
private static extern int SendMessage(IntPtr hWnd, int Msg, int wp, int lp);
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(Handle, 161, 2, 0);
}
}