private Point mouse_offset;
private void Control_MouseDown(object sender,System.Windows.Forms.MouseEventArgs e)
{
mouse_offset = new Point(-e.X,-e.Y);
}
private void Control_MouseMove(object sender,System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouse_offset.X, mouse_offset.Y);
((Control)sender).Location = ((Control)sender).Parent.PointToClient(mousePos);
}
this.label1.Text ="橫坐標:"+mouse_offset.X+"縱坐標"+mouse_offset.Y;
}