Results 1 to 13 of 13

Thread: Print through WinForms

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    8

    Print through WinForms

    Hello,

    I have a printer named Datecs EP-50.
    I have this code:

    Code:
    e.Graphics.DrawString("  NOTA DE PLATA",print10B,Brushes.Black,10,0);
                
                e.Graphics.DrawString(" Masa: ", print8B, Brushes.Black, 8, 35);
                e.Graphics.DrawString(label_pin.Tag.ToString(),print8B, Brushes.Black, 48, 35);
                e.Graphics.DrawString(" Data: ", print8B, Brushes.Black,8 , 50);
                int length = DateTime.Now.Day.ToString().Length + DateTime.Now.Month.ToString().Length + DateTime.Now.Year.ToString().Length + DateTime.Now.ToShortTimeString().Length;
                int length2 = " Data: ".Length + 3;
                e.Graphics.DrawString(DateTime.Now.Day+"/"+DateTime.Now.Month+"/"+DateTime.Now.Year+"  "+DateTime.Now.ToShortTimeString(), print8B, Brushes.Black, length2+length, 70);
                e.Graphics.DrawString("-----------------------------------------", new Font(dataGridView1.Font.FontFamily, 8, FontStyle.Regular), Brushes.Black, 10, 80);
                e.Graphics.DrawString("Produs   | Cant | Pret | Total ", print8B, Brushes.Black, 10, 110);
                int height = 0;
                int x = 10;
                
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    e.Graphics.DrawString(dataGridView1.Rows[i].Cells["DenumireProdus"].Value.ToString(), print6B, Brushes.Black, x, 130+height);
                    e.Graphics.DrawString(dataGridView1.Rows[i].Cells["produs_cantitate"].Value.ToString(), print6B, Brushes.Black, x+70, 130 + height);
                    e.Graphics.DrawString(dataGridView1.Rows[i].Cells["produs_pret"].Value.ToString() , print6B, Brushes.Black, x+105, 130 + height);
                    e.Graphics.DrawString(dataGridView1.Rows[i].Cells["produsvaloare"].Value.ToString(), print6B, Brushes.Black, x + 135, 130 + height);
                    height += 20;
                    
                }
                e.Graphics.DrawString("-----------------------------------------", new Font(dataGridView1.Font.FontFamily, 8, FontStyle.Regular), Brushes.Black, 10,dataGridView1.Height+_maxPage+_page+46);
                e.Graphics.DrawString("Total:  " + textBox1.Text+" RON", print10B, Brushes.Black,40,dataGridView1.Height + _maxPage+20+_page+55);
    My problem is that this code only prints the header and another 7 records. After the 7-th record the printer stops printing. Why does it happening ?
    Last edited by vlasin; Jan 28th, 2012 at 01:04 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width