Mga master khbaw mo unsa pag print sa multiple pages mao neh koa codes...
private void PrintDocument()
{
PrintDocument prnDoc = new PrintDocument();
PrintDialog prnDlg = new PrintDialog();
prnDlg.Document = prnDoc;
prnDoc.PrintPage += new PrintPageEventHandler(prnDoc_PrintPage);
if (DialogResult.OK == prnDlg.ShowDialog())
{
prnDoc.Print();
}
}
int y = 0; // Y point Offset
void prnDoc_PrintPage(object sender, PrintPageEventArgs e)
{
for (int i = 0; i < 100; i++)
{
e.Graphics.DrawString("Hello " + i, new Font("Courier New", 12), new SolidBrush(Color.Red), new PointF(12, y));
y += 20;
if (y >= e.PageBounds.Height)
{
y = 0;
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}
}
}