2016-06-01 3 views
0

異なるページで異なるデータを印刷しようとしています。Cで異なるシートの異なるデータを印刷する方法#

例: - abc、xys、123 =異なるデータ。

今、私はabcを1ページに印刷したいと思います。 2ページ目のxyz。他のページの123。 pleseは助け、私は私がトミーGrovnesによって提供さ

private void button1_Click(object sender, EventArgs e) 
    { 
     printDialog1.Document = printDocument1; 
     DialogResult result = printDialog1.ShowDialog(); 
     { 
      if (result == DialogResult.OK) 
      { 
       printDocument1.PrintPage += new PrintPageEventHandler(this.document_PrintPage); 
       printDocument1.Print(); 
      } 


     } 

    } 
    // private System.Drawing.Printing.PrintDocument printDocument1 = new System.Drawing.Printing.PrintDocument(); 

    // The PrintDialog will print the document 
    // by handling the document's PrintPage event. 
    private void document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) 
    { 

     // Insert code to render the page here.This code will be called when the control is drawn. 

     // The following code will render a simple message on the printed document. 


     System.Drawing.Font printFont = new System.Drawing.Font("Arial", 14, System.Drawing.FontStyle.Regular); 

     // Draw the content. 
     e.Graphics.DrawString((name + "\n" + address + "\n" + address2 + "\n" + address3).ToString(), printFont, System.Drawing.Brushes.Black, 500, 300); 
    } 

答えて

関連する問題