无边框窗体移动
程序员文章站
2022-07-14 12:20:51
...
private int x;
private int y;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
this.x = e.X;
this.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 - this.x, this.Location.Y + e.Y - this.y);
}
}
上一篇: 非诚勿扰(低配)
下一篇: M - 非诚勿扰 优先队列