Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
- {
- e.Graphics.DrawImage(bmp, 0, 0);
- }
- Bitmap bmp;
- private void btnPrint_Click(object sender, EventArgs e)
- {
- btnPrint.Hide();
- PrintDocument document = new PrintDocument();
- Graphics g = this.CreateGraphics();
- bmp = new Bitmap(this.Size.Width, this.Size.Height, g);
- Graphics mg = Graphics.FromImage(bmp);
- mg.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, this.Size);
- this.printDocument1.DefaultPageSettings.Landscape = true;
- printPreviewDialog1.Document = printDocument1;
- //printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("PapperA4", 827, 1169);
- printPreviewDialog1.ShowDialog(calendar1);
- btnPrint.Show();
- }
Add Comment
Please, Sign In to add comment