471,071 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

HasMorePages = true doesn't let me jump to next page

Leo
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;
...
}
}

Apr 19 '06 #1
2 7328
What do you mean "doesn't let [you] jump to the next page"? You're the
one who controls which page is printed when OnPrintPage is called. I
can't really tell from your code, but I'm guessing that the problem is
that you're getting the list of things to print and starting to loop
through it in your OnPrintPage method, so every time the method is
called you start again at the beginning.

You should do things like get the list of things to print and reset
your "loop" counter in OnBeginPrint. OnPrintPage should start printing
from where it left off last time it was called.

There is no magic "jump to next page"... you have to handle that
yourself.

Apr 19 '06 #2
"Leo" <pk*******@yahoo.com> ha scritto nel messaggio
news:11**********************@i40g2000cwc.googlegr oups.com...
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.


e.HasMorePages just does what it means: tell if the document has more pages
to be printed.

When you exit from the method you reached the "jump to next page" (of cours,
if the document HasMorePages).
--

Free .Net Reporting Tool - http://www.neodatatype.net
Apr 19 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Mr. B | last post: by
reply views Thread by creedence | last post: by
reply views Thread by Scotty | last post: by
2 posts views Thread by GGSoft | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.