Drawing 2D lines without using primitives
From XNAWiki
The XNA Framework doesn't provide a way to draw simple lines natively, without resorting to the 3D DrawPrimitives methods. If you want to stick exclusively with SpriteBatch, there's a way to do so.
First, create a simple 1x1 Texture2D, like this:
Texture2D blank = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
blank.SetData(new[]{Color.White});Now, given any two points, you can draw a 2D line by calculating the length and angle of the line segment formed by these two points. You pass the length of the line into the "scale" parameter and the angle into the "rotation" parameter of SpriteBatch.Draw().
void DrawLine(SpriteBatch batch, Texture2D blank,
float width, Color color, Vector2 point1, Vector2 point2)
{
float angle = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);
float length = Vector2.Distance(point1, point2);
batch.Draw(blank, point1, null, color,
angle, Vector2.Zero, new Vector2(length, width),
SpriteEffects.None, 0);
}