I have written an application in C# but need help with formatting/ alignment. The code is shortened so as to focus on the problem. I'm printing transactions to a receipt printer but need to right align the net amounts.
Example
Item Amt Cost Net Amt
USD 30 66.50 1995.00
USD 1400 66.80 93520.00
PrintDocument pd = new PrintDocument();
pd.Print();
private void PrintPageEvent( object sender, PrintPageEventArgs ev)
{
float topMargin = ev.PageBounds.Top;
float leftMargin = ev.PageBounds.Left;
// where transaction is a string as indicated above
string trans = String.Format("{0}\t{1}\t{2:F2}\t{3:N}", item, Amt, Cost, NetAmt);
Graphics g = ev.Graphics;
g.DrawString(trans, printFont, Brushes.Black, leftMargin, ...);
}