private Point mypoint; private void panel1_MouseDown(object sender, MouseEventArgs e) { mypoint = new Point(-e.X, -e.Y); } private void panel1_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Point myPosition = MousePosition; myPosition.Offset(mypoint); DesktopLocation = myPosition; } }
标签:窗口,sender,Point,拖动,void,myPosition,private,mypoint,WinForm From: https://www.cnblogs.com/zzuwangzhen/p/17648814.html