A
alexey_r
MSDN (<http://msdn2.microsoft.com/en-us/library/7y237t0c.aspx>) says
that this method is supposed to throw only ArgumentNullException, but
this code:
protected override void OnPrintPage(PrintPageEventArgs e)
{
base.OnPrintPage(e);
Graphics gdiPage = e.Graphics;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
float lineHeight = printFont.GetHeight(gdiPage.DpiY);
float linesPerPage = e.MarginBounds.Height / lineHeight;
string lineText = null;
// Print each line of the text that fits on the page.
while (lineCount < numberOfLines)
{
lineText = lines[lineCount];
gdiPage.DrawString(lineText, printFont, Brushes.Black,
leftMargin, (topMargin + (lineCount *
lineHeight)));
lineCount++;
if (lineCount % linesPerPage == 0)
break;
}
// If more lines exist, print another page.
e.HasMorePages = (lineCount < numberOfLines);
}
throws ArgumentException at the line
float lineHeight = printFont.GetHeight(gdiPage.DpiY);
_if_ it prints at least two pages. Can anybody suggest why?
that this method is supposed to throw only ArgumentNullException, but
this code:
protected override void OnPrintPage(PrintPageEventArgs e)
{
base.OnPrintPage(e);
Graphics gdiPage = e.Graphics;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
float lineHeight = printFont.GetHeight(gdiPage.DpiY);
float linesPerPage = e.MarginBounds.Height / lineHeight;
string lineText = null;
// Print each line of the text that fits on the page.
while (lineCount < numberOfLines)
{
lineText = lines[lineCount];
gdiPage.DrawString(lineText, printFont, Brushes.Black,
leftMargin, (topMargin + (lineCount *
lineHeight)));
lineCount++;
if (lineCount % linesPerPage == 0)
break;
}
// If more lines exist, print another page.
e.HasMorePages = (lineCount < numberOfLines);
}
throws ArgumentException at the line
float lineHeight = printFont.GetHeight(gdiPage.DpiY);
_if_ it prints at least two pages. Can anybody suggest why?