Hi, i'm having a problem trying to print out a list of strings. i can get them to print out using rectangles successfully but when the bottom of the page is reached it wont go onto the next page, instead it just stops printing.
I've done this so far which just repeats the first page over and over rather than just printing the rest of the text on a new page:
private void document_PrintPage(object sender, PrintPageEventArgs e)
{
List<string> propNames = new List<string>();
List<string> propValue = new List<string>();
Font titleFont = new Font("Arial", 22, System.Drawing.FontStyle.Regular);
string title = "Object State Default";
RectangleF rect = new RectangleF();
rect.X = 50.0F;
rect.Y = 30.0F;
rect.Width = 300.0F;
rect.Height = 50.0F;
SolidBrush brush = new SolidBrush(Color.Black);
Pen blackpen = new Pen(Color.Transparent);
Font printFont = new Font("Arial", 11, System.Drawing.FontStyle.Regular);
//Gets names of all properties
propNames = printObject(objtyp);
//Gets values of all properties
propValue = getPrintValues();
//Draws title of the page
e.Graphics.DrawString(title, titleFont, brush, rect);
//Sets position for next rectangle
rect.Y = rect.Y + 75;
for (int i = 0; i < propNames.Count && i < propValue.Count; i++)
{
e.Graphics.DrawString(propNames.ElementAt(i), printFont, brush, rect);
rect.X = rect.X + 300;
e.Graphics.DrawString(propValue.ElementAt(i), printFont, brush, rect);
rect.Y = rect.Y + 30;
if (rect.Y >= 1100)
{
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}
}
}
Any help with this would be great !
Thanks
Chris