how to print a panel control

ramone

New member
Joined
May 23, 2006
Messages
1
Programming Experience
5-10
hello
i created a chart class, it inherits a panel control and it is drawn over the panel using graphics.DrawLine and the like, i used a panel because it was the best thing i thought at that time :eek:, the chart uses the panel to resize and calculate the proportion between pixels and the units used by the chart

is there a way to print the panel or the lines and strings drawn??

thank you so much!
 
All .NET printing is done the same way: using a PrintDocument. You handle its PrintPage event and use GDI+ to draw whatever you want printed. For you it will simply be a matter of repeating whatever you've drawn on the control, so it will be easy.
 
ramone, it is also easy for you to change your code to draw to a Bitmap instead of Panel, then display Bitmap in a Picturebox control. Later when wanting to print you use Graphics.DrawImage with this Bitmap (or Image from Picturebox) without need to compose chart again.
 
Back
Top