private void btnPrintForm_Click(object sender, EventArgs e)
{
printDocument2.Print();
}
private void printDocument2_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics info = e.Graphics;
String infomessage = DateTime.Today.ToString("d") + "\r\n" + listView1.Items[0].SubItems[4].Text;
Font infoFont = new Font("Arial", 12, System.Drawing.GraphicsUnit.Point);
info.DrawString(infomessage, infoFont, Brushes.Black, 250, 200);
}
My above code shows printing of my listview,
What i am trying to print is a new page for each listview row.
My failed attempts so far frint the same info on multiple sheets and different infor over the same sheet.
Thanks in advance.
cory thompsonPosted Oct 5, 2012, 2:21 PM
private void btnPrintForm_Click(object sender, EventArgs e)
{
printDocument2.Print();
}
private void printDocument2_PrintPage(object sender, PrintPageEventArgs e)
{
foreach (ListViewItem lvi in listview1)
{
Graphics info = e.Graphics;
String infomessage = DateTime.Today.ToString("d") + "\r\n" + listView1.Items[0].SubItems[4].Text;
Font infoFont = new Font("Arial", 12, System.Drawing.GraphicsUnit.Point);
info.DrawString(infomessage, infoFont, Brushes.Black, 250, 200);
}
}
This does not work. This will print each row over the top of the last on the same page.