, Visual C#


              


int counter = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
float linesPerPage = e.MarginBounds.Height /
myPrintFont.GetHeight(e.Graphics);
while (counter < linesPerPage)
{
line = myPrintFile.ReadLine();
if (line == null)
{
break;
}
yPos = topMargin + counter *
myPrintFont.GetHeight(e.Graphics);
e.Graphics.DrawString(line, myPrintFont,
Brushes.Black, leftMargin, yPos,
new StringFormat());
counter++;
}
if (line != null)
{
e.HasMorePages = true;
}
}
. : Build, Build Solution; Debug, Start Without Debugging. Form1 . Print. . Visual Studio .
.