void col_MouseMove(object sender, MouseEventArgs e) { //if (IsMove == false) return; if (IsManage && e.Button == MouseButtons.Left) { if (Math.Abs(e.X - _P.X) > 10 || Math.Abs(e.Y - _P.Y) > 10) { if (IsMove == false) { if (pic_img.Visible == false) { pic_img.Visible = true; } //GZFrameworkDemo.Library.ModuleFun.GZLockMouse.Lock((int)pan_Container.Handle); IsMove = true; } Point p = new Point(e.X + Location.X, e.Y + Location.Y); CellTo = GT.GetCellByPoint(p); pic_img.Location = new Point(p.X - pic_img.Width / 2, p.Y - pic_img.Height / 2); } //pic_img.Location = new Point(pic_img.Left + e.X - _P.X, pic_img.Top + e.Y - _P.Y); //pic_img.Left += e.X - _P.X; //pic_img.Top += e.Y - _P.Y; //_P.X = e.X; _P.Y = e.Y;// = new Point(e.X, e.Y); } }
void col_MouseDown(object sender, MouseEventArgs e) { if (IsManage && e.Button == MouseButtons.Left) { Location = (sender as Control).Location; Point P = new Point(e.X + Location.X, e.Y + Location.Y); CellFrom = GT.GetCellByPoint(P); var CurrentCol = CellFrom.ContainControl; pic_img.Image = (CurrentCol as SimpleButton).Image; _P = new Point(e.X, e.Y); pic_img.Location = new Point(P.X - (pic_img.Width / 2), P.Y - (pic_img.Height / 2)); } }