/// <summary>Called when the mouse position is updated</summary> /// <param name="x">X coordinate of the mouse cursor on the GUI</param> /// <param name="y">Y coordinate of the mouse cursor on the GUI</param> protected override void OnMouseMoved(float x, float y) { if (_beingDragged) { // Adjust the control's position within the container var dx = x - _pickupX; var dy = y - _pickupY; Bounds.AbsoluteOffset(dx, dy); } else { // Remember the current mouse position so we know where the user picked // up the control when a drag operation begins _pickupX = x; _pickupY = y; } }