Click here to Skip to main content
15,905,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone.
I have a tablelayout panel with 5 rows and 3 columns , each cell is a richTextBox
How can I print the the tablelayout panel with the text in the richTextBoxes.

Can anyone help me?
Posted
Comments
Kenneth Haugland 15-Jul-12 8:42am    
Printing can be rather complicated, is it Windows Forms or WPF?
B.Tariq 17-Jul-12 4:41am    
It is Windows Forms
Sandeep Mewara 15-Jul-12 10:09am    
ASP.NET?

Please try this may help you


C#
//Create a temporary image to draw into
//with the dimensions of your TableLayoutPanel
using (Bitmap printImage = new Bitmap(myTableLayoutPanel.Width, myTableLayoutPanel.Height))
   {
      //Draw the TableLayoutPanel control to the temporary bitmap image
      myTableLayoutPanel.DrawToBitmap(printImage, new Rectangle(0, 0, printImage.Width, printImage.Height));

      //(...your code continues here, except that now you
      // will print the temporary image you just created)
      printPreviewDialog1.Document = PrintDoc1;
      PrintDoc1.PrintPage += printDocument2_PrintPage;
      printPreviewDialog1.ShowDialog()
   }
 
Share this answer
 
You will need to send the array of label names to the print page handler, using this array, set the X and Y Positions with a for loops
 
Share this answer
 

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