0

I have a print button in a WinForms form. Panels that are created dynamically must be printed in A4 and landscape, and everything must fit into the page. How can this be built?

honk
  • 9,137
  • 11
  • 75
  • 83
Hicham4
  • 39
  • 1
  • 8
  • make a screenshot of the window and resize it to A4 Edit: programmatically – Sebastian L Aug 03 '18 at 11:57
  • 1
    Possible duplicate of [Print Panel in Windows Form C#](https://stackoverflow.com/questions/10605840/print-panel-in-windows-form-c-sharp) – Renatas M. Aug 03 '18 at 12:03
  • I don't want to print the entire window, I only want to print the panels (and of course the content) in the window. – Hicham4 Aug 03 '18 at 12:05
  • @Reniuz. thank you for your comment, I'm going to try the solution of your link – Hicham4 Aug 03 '18 at 12:09
  • Do note the quirk in DrawToBitmap: If the controls has several nested controls in it those will be stacked in the reverse order! To fix it you would have to reverse their order temporarily.. – TaW Aug 03 '18 at 12:12
  • 2
    Printing controls is a pretty universally bad idea. Controls were designed to display well on monitors, low resolution devices. With tricks to make it still look decent in spite of the low resolution, ClearType anti-aliasing is standard. That does *not* work well when you print, every one pixel on the screen turns into a ~6x6 blob of ink. The text looks very grainy and the anti-aliasing doesn't work at all. Don't do it. Use Graphics.ScaleTransform() to make stuff fit. – Hans Passant Aug 03 '18 at 12:16

0 Answers0