共用方式為


MathHelper.Clamp Method

Restricts a value to be within a specified range.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static float Clamp (
         float value,
         float min,
         float max
)

Parameters

  • value
    The value to clamp.
  • min
    The minimum value.
  • max
    The maximum value.

Return Value

The clamped value.

See Also

Reference

MathHelper Class
MathHelper Members
Microsoft.Xna.Framework Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista