cory thompson

cory thompson

  • NA
  • 29
  • 27.4k

Printing a foreach in c# Forms

Oct 5 2012 10:00 AM
I am trying to print a page for each item in my listview.

        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.

Answers (1)