By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,854 Members | 876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,854 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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.