LayoutFarm.DzBoardSample.UIControllerBox.MoveTo C# (CSharp) Method

MoveTo() public method

public MoveTo ( int left, int top ) : void
left int
top int
return void
        public void MoveTo(int left, int top)
        {
            var offsetX = left - this.Left;
            var offsetY = top - this.Top;
            SetLocation(left, top);
            if (this.MasterSelectionSet != null)
            {
                MasterSelectionSet.NotifyMoveFrom(this, offsetX, offsetY);
            }
        }
        public override void SetSize(int width, int height)

Usage Example

Ejemplo n.º 1
0
        static void MoveWithSnapToGrid(UIControllerBox controllerBox, int dx, int dy)
        {
            //sample move with snap to grid

            Point pos  = controllerBox.Position;
            int   newX = pos.X + dx;
            int   newY = pos.Y + dy;
            //snap to gridsize =5;
            //find nearest snap x

            int   gridSize = controllerBox.GridSize;
            float halfGrid = (float)gridSize / 2f;
            int   nearestX = (int)((newX + halfGrid) / gridSize) * gridSize;
            int   nearestY = (int)((newY + halfGrid) / gridSize) * gridSize;

            controllerBox.MoveTo(nearestX, nearestY);
        }
All Usage Examples Of LayoutFarm.DzBoardSample.UIControllerBox::MoveTo