Guest User

Untitled

a guest
Jan 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
  2. {
  3. e.Graphics.DrawImage(bmp, 0, 0);
  4. }
  5. Bitmap bmp;
  6.  
  7.  
  8. private void btnPrint_Click(object sender, EventArgs e)
  9. {
  10. btnPrint.Hide();
  11.  
  12. PrintDocument document = new PrintDocument();
  13.  
  14. Graphics g = this.CreateGraphics();
  15. bmp = new Bitmap(this.Size.Width, this.Size.Height, g);
  16. Graphics mg = Graphics.FromImage(bmp);
  17. mg.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, this.Size);
  18.  
  19. this.printDocument1.DefaultPageSettings.Landscape = true;
  20.  
  21.  
  22. printPreviewDialog1.Document = printDocument1;
  23. //printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("PapperA4", 827, 1169);
  24.  
  25. printPreviewDialog1.ShowDialog(calendar1);
  26. btnPrint.Show();
  27. }
Add Comment
Please, Sign In to add comment