SpriteBatch.Drawline(null, new Vector2(100, 100), new Vector2(300, 100), Color.Red, 2);
Texture2D lineTexture = new Texture2D(GraphicsDevice, 1, 1); lineTexture.SetData(new Color[] { Color.White }); SpriteBatch.DrawLine(lineTexture, new Vector2(50, 50), new Vector2(50, 150), Color.Blue, 3);This code creates a 1x1 white texture and uses it to draw a blue line with a thickness of 3 pixels from point (50, 50) to point (50, 150). The Microsoft.Xna.Framework.Graphics.SpriteBatch.DrawLine method is part of the MonoGame framework library.