Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Sample : Form
- {
- public Sample()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- private void myPrintDocument1_PrintPage(System.Object sender,PrintPageEventArgs e)
- {
- Bitmap myBitmap2 = new Bitmap(this.Width, this.Height);
- this.DrawToBitmap(myBitmap2, new Rectangle(0, 0, this.Width, this.Height));
- e.Graphics.DrawImage(myBitmap2,0,0);
- myBitmap2.Dispose();
- }
- private void buttPrint_Click(object sender, EventArgs e)
- {
- PrintDocument myPrintDocument2 = new PrintDocument();
- PrintDialog myPrinDialog2 = new PrintDialog();
- myPrintDocument2.PrintPage += new PrintPageEventHandler(myPrintDocument1_PrintPage);
- myPrinDialog2.Document = myPrintDocument2;
- if (myPrinDialog2.ShowDialog() == DialogResult.OK)
- {
- myPrintDocument2.Print();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement