当窗体没有边框的时候,可以使用该方法拖动窗体
Point downpoint;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
downpoint.X = e.X;
downpoint.Y = e.Y;
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Location = new Point(this.Location.X + e.X - downpoint.X, this.Location.Y + e.Y - downpoint.Y);
}
}