Game Development Reference
In-Depth Information
float positionY = e.MarginBounds.Top +
(lineCount * printFont.GetHeight(e.Graphics));
lineCount += PrintLine(e, line, positionY);
}
// Print a new page if there are more lines to print
if (line != null)
e.HasMorePages = true;
else
e.HasMorePages = false;
}
private int PrintLine(PrintPageEventArgs e, string text, float positionY)
{
RectangleF rectangle = new RectangleF(e.PageSettings.Margins.Left,
positionY,
e.MarginBounds.Width,
e.MarginBounds.Height);
int lines;
int characters;
StringFormat format = new StringFormat();
e.Graphics.MeasureString(text,
printFont,
rectangle.Size,
format,
out characters,
out lines);
// Total text will not fit on page; bump to overflow buffer for next page
if (characters < text.Length)
{
bufferOverflow = text.Substring(characters);
}
else
{
bufferOverflow = null;
}
Search Nedrilad ::




Custom Search