jo

jo

  • NA
  • 8
  • 0

print orders from different places

Feb 18 2010 7:46 AM

Hello,

i am very new to C# so please be patient.

i am printing orders in my app.
so i have a button which creates the printjob.
the paper will be written in the Printpage-Event.

now i want to have a function that gets th order-object as a parm
and print it on the paper.

the reason is, that an order must be printed on severall programm modules.
 private void btnDruck_Click(object sender, EventArgs e)
{
 PrintDocument Druckjob = new PrintDocument();
 PrintDialog Druckermenue = new PrintDialog();
 PrintPreviewDialog Druckpreview = new PrintPreviewDialog();
 Druckjob.DocumentName = "Rechnung";
 Druckjob.PrintPage += new PrintPageEventHandler(Druckjob_PrintPage);
 Druckpreview.Document = Druckjob;
 Druckermenue.Document = Druckjob;
 if (Druckermenue.ShowDialog() == DialogResult.OK)
 {
  Druckjob.Print();
 }
 Druckjob.PrintPage -= new PrintPageEventHandler(Druckjob_PrintPage);
 
}
void Druckjob_PrintPage(object sender, PrintPageEventArgs e)
{
 Graphics g = e.Graphics;
 StringFormat lineFmtRight = new StringFormat();
 lineFmtRight.Alignment = StringAlignment.Far;
 g.PageUnit = GraphicsUnit.Millimeter;
 // Druckausgabe ...
 // Drucken ..
 g.Dispose();
}

 

Answers (1)