ComponentFactory.Krypton.Toolkit.ViewDrawDocker.AdjustPaddingForDockers C# (CSharp) Method

AdjustPaddingForDockers() private method

private AdjustPaddingForDockers ( Padding padding, Rectangle fillerRect, int borderWidth ) : Padding
padding Padding
fillerRect System.Drawing.Rectangle
borderWidth int
return Padding
        private Padding AdjustPaddingForDockers(Padding padding,
                                                Rectangle fillerRect,
                                                int borderWidth)
        {
            // Find the distance the filler rect is displated inside the client area
            int topDiff = fillerRect.Y;
            int leftDiff = fillerRect.X;
            int bottomDiff = ClientRectangle.Bottom - fillerRect.Bottom;
            int rightDiff = ClientRectangle.Right - fillerRect.Right;

            // Calculate how far the rounding effects work
            int pullBackTop = padding.Top * 2;
            int pullBackBottom = padding.Bottom * 2;
            int pullBackLeft = padding.Left * 2;
            int pullBackRight = padding.Right * 2;

            if ((padding.Left > borderWidth) &&
                ((topDiff >= pullBackTop) && (topDiff >= padding.Top)) &&
                ((bottomDiff >= pullBackBottom) && (bottomDiff >= padding.Bottom)))
                padding.Left = borderWidth;

            if ((padding.Right > borderWidth) &&
                ((topDiff >= pullBackTop) && (topDiff >= padding.Top)) &&
                ((bottomDiff >= pullBackBottom) && (bottomDiff >= padding.Bottom)))
                padding.Right = borderWidth;

            if ((padding.Top > borderWidth) &&
                ((leftDiff >= pullBackLeft) && (leftDiff >= padding.Left)) &&
                ((rightDiff >= pullBackRight) && (rightDiff >= padding.Right)))
                padding.Top = borderWidth;

            if ((padding.Bottom > borderWidth) &&
                ((leftDiff >= pullBackLeft) && (leftDiff >= padding.Left)) &&
                ((rightDiff >= pullBackRight) && (rightDiff >= padding.Right)))
                padding.Bottom = borderWidth;

            return padding;
        }