Mover un formulario de un lugar a otro

PHOTO EMBED

Fri Mar 11 2022 20:00:58 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio #cs

using System.Runtime.InteropServices;

public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;

[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();

private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{     
    if (e.Button == MouseButtons.Left)
    {
        ReleaseCapture();
        SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
    }
}
content_copyCOPY

https://stackoverflow.com/questions/7286837/how-to-move-form-in-c-net