I set HasMorePages to true, but it doesn't let me jump to next page.
(Of course, if I remove the HasMorePages = false in my if statement, it
will create hundreds of pages). Any suggestion? Thanks in advance.
Leo
My code to call the print event:
....
{
m_PrintDoc = new PrintDocument();
m_PrintDoc.PrintPage += new
PrintPageEventHandler(this.OnPrintPage);
m_PrintDoc.DefaultPageSettings.Landscape = false;
m_PrintDoc.DocumentName = "Wall Layout";
m_Preview = new PrintPreviewDialog();
((Form)m_Preview).WindowState = FormWindowState.Maximized;
m_Preview.Document = m_PrintDoc;
m_Preview.ShowDialog();
m_Preview.Dispose();
...
}
private void OnPrintPage(object sender,PrintPageEventArgs e)
{
ArrayList lumberList = m_Wall.GetLumberListBySize();
for (int i = 0; i < lumberList.Count; i++)
{
if (m_yPos > m_BottomMargin)
{
m_yPos = m_TopMargin;
e.HasMorePages = true;
}
else
e.HasMorePages = false;
...
}
}