Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
C#
private void myPrintDocument2_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Bitmap myBitmap1 = new Bitmap(panel.Width, panel.Height);
            panel.DrawToBitmap(myBitmap1, new Rectangle(0, 0, panel.Width, panel.Height));
            e.Graphics.DrawImage(myBitmap1, 0, 0);
            myBitmap1.Dispose();
        }

        private void print(object sender, EventArgs e)
        {
            System.Drawing.Printing.PrintDocument myPrintDocument1 = new System.Drawing.Printing.PrintDocument();
            myPrintDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(myPrintDocument2_PrintPage);
            myPrintDocument1.Print();
        }
Posted
Updated 23-Sep-14 1:15am
v3
Comments
gggustafson 24-Sep-14 15:22pm    
See http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument(v=vs.90).ASPX

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900