Click here to Skip to main content
15,902,114 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one panel(big) and this panel contain other panel (smaller panel) i need to print all content in big panel ??
Posted
Comments
Sergey Alexandrovich Kryukov 2-Jan-12 13:57pm    
What panel? Do you thing there is only one class with this name? Tag it: WPF, Silverlight, Forms, what?
--SA

I would say this is a bad idea (print data, not UI), but if you really need something like this with System.Windows.Forms.Panel (which you did not specify, please see my comment to the question), you need to use the class System.Drawing.Printing.PrintDocument, see http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^], see a code sample closer the end of this page.

—SA
 
Share this answer
 
Comments
shadiabusamra 2-Jan-12 14:11pm    
panel contain graphic
Sergey Alexandrovich Kryukov 2-Jan-12 17:56pm    
That's why I answered this way: graphics is rendered using the instance of System.Drawing.Graphics you obtain through and instance of PrintDocument. You have to have all drawing method abstracted from graphics (on other words, instance passed as a parameter), this way you will be able to draw same thing on screen and printer device. Again, see the sample code in the article I've provided.
--SA
Espen Harlinn 2-Jan-12 17:39pm    
Good points :)
Sergey Alexandrovich Kryukov 2-Jan-12 17:57pm    
Thank you, Espen, but OP did not get it, trying to explain in my comments...
--SA
Check the below article
printing Contents of Panel Control using Print Preview Dialog [^]
given article using PrintDocument class that is used to defines a reusable object that sends output to a printer, when printing from a Windows Forms application.
 
Share this answer
 
Comments
shadiabusamra 2-Jan-12 14:34pm    
thank you very much
RaviRanjanKr 2-Jan-12 15:04pm    
most welcome :)
Rakesh B Singh 13-Apr-12 3:41am    
Thank you for referring to my article....

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