/ dataGridView1 is the DataGridView to print
GridPrintDocument doc = new GridPrintDocument(this.dataGridView1,
this.dataGridView1.Font, true);
doc.DocumentName = "Preview Test";
doc.DefaultPageSettings.Landscape = true;
doc.DefaultPageSettings.PrinterSettings.FromPage = 1;
doc.DefaultPageSettings.PrinterSettings.ToPage = 3;
PrintPreviewDialog printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.ClientSize = new Size(400, 300);
printPreviewDialog.Location = new Point(29, 29);
printPreviewDialog.Name = "Print Preview Dialog";
printPreviewDialog.UseAntiAlias = true;
printPreviewDialog.Document = doc;
printPreviewDialog.ShowDialog();
doc.Dispose();
doc = null;
Wednesday, September 8, 2010
Datagridview Data Print
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment