c# - Make a borderless form movable? - Stack Overflow

PHOTO EMBED

Thu Nov 02 2023 22:29:01 GMT+0000 (Coordinated Universal Time)

Saved by @amman

private bool mouseDown;
private Point lastLocation;

    private void Form1_MouseDown(object sender, MouseEventArgs e)
    {
        mouseDown = true;
        lastLocation = e.Location;
    }

    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
        if(mouseDown)
        {
            this.Location = new Point(
                (this.Location.X - lastLocation.X) + e.X, (this.Location.Y - lastLocation.Y) + e.Y);

            this.Update();
        }
    }

    private void Form1_MouseUp(object sender, MouseEventArgs e)
    {
        mouseDown = false;
    }
content_copyCOPY

https://stackoverflow.com/questions/1592876/make-a-borderless-form-movable