protected override void OnMoving(MovingEventArgs mea) { ISnapManagerHost owner = base.Owner as ISnapManagerHost; if (owner != null) { SnapManager snapManager = owner.SnapManager; if (!this.isMoving) { this.movingCursorDelta = new Size(Cursor.Position.X - mea.Rectangle.X, Cursor.Position.Y - mea.Rectangle.Y); this.isMoving = true; } mea.Rectangle = new Rectangle(Cursor.Position.X - this.movingCursorDelta.Width, Cursor.Position.Y - this.movingCursorDelta.Height, mea.Rectangle.Width, mea.Rectangle.Height); this.snapObstacle.SetBounds(mea.Rectangle.ToRectInt32()); PointInt32 newLocation = mea.Rectangle.Location.ToPointInt32(); PointInt32 location = snapManager.AdjustObstacleDestination(this.SnapObstacle, newLocation); RectInt32 bounds = new RectInt32(location, mea.Rectangle.Size.ToSizeInt32()); this.snapObstacle.SetBounds(bounds); mea.Rectangle = bounds.ToGdipRectangle(); } base.OnMoving(mea); }