Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Doc_PrintPage(object sender, PrintPageEventArgs e)
- {
- float x = e.MarginBounds.Left;
- float y = e.MarginBounds.Top;
- Bitmap bmp = new Bitmap(this.grbSummarySheet.Width, this.grbSummarySheet.Height);
- this.grbSummarySheet.DrawToBitmap(bmp, new Rectangle(0, 0, this.grbSummarySheet.Width, this.grbSummarySheet.Height));
- e.Graphics.DrawImage((Image)bmp, x, y);
- }
- private void btnPrint_Click(object sender, EventArgs e)
- {
- PrintDocument doc = new PrintDocument();
- doc.PrintPage += this.Doc_PrintPage;
- doc.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("PaperA3", 1200, 1180);
- PrintDialog dlgSettings = new PrintDialog();
- dlgSettings.Document = doc;
- if (dlgSettings.ShowDialog() == DialogResult.OK)
- {
- doc.Print();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement