private void button5_Click(object sender, EventArgs e) { int k=0; for (int i = 0; i < dataGridView1.RowCount && k < 3878; i++) { k = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value); ctot25 = Convert.ToInt32(dataGridView1.Rows[i].Cells[13].Value); ctot50 = Convert.ToInt32(dataGridView1.Rows[i].Cells[14].Value); ctot100 = Convert.ToInt32(dataGridView1.Rows[i].Cells[15].Value); if (i > 0 && ctot25 != 0 || ctot50 != 0 || ctot100 != 0) { label33.Text = (dataGridView1.Rows[i].Cells[1].Value).ToString(); label34.Text = (dataGridView1.Rows[i].Cells[0].Value).ToString(); System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument(); doc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage); PrintDialog PrintSettings = new PrintDialog(); PrintSettings.Document = doc; PageSettings pgsetting = new PageSettings(); if (PrintSettings.ShowDialog() == DialogResult.OK) doc.Print(); } } private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Bitmap bmp = new Bitmap(panel1.Width, panel1.Height, panel1.CreateGraphics()); panel1.DrawToBitmap(bmp, new Rectangle(0, 0, panel1.Width, panel1.Height)); RectangleF bounds = e.PageSettings.PrintableArea; e.Graphics.DrawImage(bmp, bounds.Left, bounds.Top, panel1.Width, panel1.Height); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)