void Feeder_MouseMove(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } if (_isDragging) { this.Capture = true; this.Location = new Point(this.Location.X + e.X - _mouseLocationOnButton.X, this.Location.Y + e.Y - _mouseLocationOnButton.Y); if (PanelArranged.Contains(this)) { Point location = PanelUnArranged.PointToClient(Cursor.Position); if (PanelUnArranged.ClientRectangle.Contains(location)) { location = MoveOnPanelUnArranged(location); } } else { Point location = PanelArranged.PointToClient(Cursor.Position); if (PanelArranged.ClientRectangle.Contains(location)) { location = MoveOnPanelArranged(location); } } } }
void Feeder_MouseUp(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) { return; } _isDragging = false; this.Capture = false; if (this.MvProject.IsPanelInsertMode) { if (_sourceControl is GroupBox) { ShiftPanels(); } else if (_sourceControl is Panel) { if (PanelArranged.Contains(this)) { _targetControl = GetTargetControl(this.Location); FlyToTheTarget(_targetControl, _sourceControl); PlaceFeeder(this, _targetControl); } } } else { if (PanelArranged.Contains(this)) { _targetControl = GetTargetControl(this.Location); FlyToTheTarget(_targetControl, _sourceControl); PlaceFeeder(this, _targetControl); } } return; }