Paint.HorizontalGauge.BoundedX C# (CSharp) Méthode

BoundedX() private méthode

Ensures the specified x co-ordinate is inside the bounds of the gauage
private BoundedX ( int xPosition ) : int
xPosition int /// The calculated/desired x Position ///
Résultat int
        private int BoundedX(int xPosition)
        {
            if (xPosition < this.Bounds.X)
            {
                return this.Bounds.X;
            }
            else
            {
                int maxX = this.Bounds.X + this.Bounds.Width - this.MarkerWidth;
                if (xPosition > maxX)
                {
                    return maxX;
                }
            }

            return xPosition;
        }