Hi, i'm trying to implement a print function and i can print a single string out but i'm having trouble configuring the page setup properly, mainly moving to a new line when the margin of the page is reached and moving to a new lines for each string in a list of string.

so far i have this printing out a single piece of text:

private void document_PrintPage(object sender,
        System.Drawing.Printing.PrintPageEventArgs e)
        {
            System.Drawing.Font printFont = new System.Drawing.Font
            ("Arial", 28, System.Drawing.FontStyle.Regular);

            string text = "Now then";
            // Draw the content.
            e.Graphics.DrawString(text.ToString(), printFont, System.Drawing.Brushes.Black, 10, 10);
        }

i've tried looking on the internet but musent be using the right search criteria because i can only find stuff to print one small string.

Any suggestions of how to do the above or suggestions of tutorials will be great

thanks

Try this method: http://msdn.microsoft.com/en-us/library/21kdfbzs.aspx
Now it all boils down calculating a new RectangleF below the one you already have, if you want a newline.
Remember to take the page rectangle into account when you do a newline at the bottom of the print page!
EDIT: Oh and on line 9 you don't have to do text.ToString(), because text is already a string.

Edited 5 Years Ago by ddanbe: n/a

Well spotted on the line 9. thanks i'll have a crack with your suggestion. any other suggestions are welcome

This question has already been answered. Start a new discussion instead.