Question : c# printing lines on top of each other

I am trying to print a text page on the printer. But, I cannot get it to go to a new line. The lines print on top of each other. See code. Where do I go wrong?
Code Snippet:
1:
2:
3:
4:
5:
for (int iRow = 1; iRow <= xInvoice.Length; iRow++)
            {
                e.Graphics.DrawString(xInvoice.GetRow(iRow) + "\r\n",
                    oFont, brush, x, y);
            }

Answer : c# printing lines on top of each other

Well, I'm not sure what the rest of your code looks like, but try the following (I'm deducing some information from your example that may not actually be accurate--for example, that your "xInvoice" is a collection of rows). I'm also assuming that each "row" in this collection is to be printed on its own line, directly below the former row, and that 'y' is the amount of vertical space you want between two vertically adjacent lines of text.

If it works, great; if not, let me know, and provide some more details about your implementation.

I casted the last argument to int because I believe FontHeight returns a Single, though I can't remember for sure (been a while since I worked with fonts, and this computer doesn't have VS. IE barely runs, so forget looking it up. Dang school library comps.).

Hope it helps,
Nate

1:
2:
3:
4:
5:
for (Int32 row = 1; row <= xInvoice.Length; row++)
{
    e.Graphics.DrawString(xInvoice.GetRow(row),
        oFont, brush, x, (Int32)(y + (row * oFont.FontHeight)));
}
Random Solutions  
 
programming4us programming4us