Make a borderless form movable?

前端 未结 21 2138
情歌与酒
情歌与酒 2020-11-22 09:48

Is there a way to make a form that has no border (FormBorderStyle is set to \"none\") movable when the mouse is clicked down on the form just as if there was a border?

21条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 10:32

    Easiest way is:

    First create a label named label1. Go to label1's events > mouse events > Label1_Mouse Move and write these:

    if (e.Button == MouseButtons.Left){
        Left += e.X;
        Top += e.Y;`
    }
    

提交回复
热议问题