SpriteBatch.Draw Method (Texture2D, Vector2, Nullable<Rectangle>, Color)

Adds a sprite to the batch of sprites to be rendered, specifying the texture, screen position, source rectangle, and color tint.

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

public void Draw (
         Texture2D texture,
         Vector2 position,
         Nullable<Rectangle> sourceRectangle,
         Color color


The sprite texture.
The location, in screen coordinates, where the sprite will be drawn.
A rectangle specifying, in texels, which section of the rectangle to draw. Use null to draw the entire texture.
The color channel modulation to use. Use Color.White for full color with no tinting.

Exception typeCondition
ArgumentNullException texture is null.
InvalidOperationException Draw was called, but Begin has not yet been called. Begin must be called successfully before Draw can be called.

Before any calls to Draw, you must call Begin. Once all calls to Draw are complete, call End.

Xbox 360, Windows XP SP2, Windows Vista, Zune