locked
How can I print the winform in high quality? RRS feed

  • Question

  • hey.I using this code for printing form :

    https://msdn.microsoft.com/en-us/library/6he9hz8c%28v=vs.110%29.aspx

    but the output sheet is not clear as well.

    Monday, April 18, 2016 6:08 AM

Answers

All replies

  • Hi Mahdi Hokom,

    Maybe you could try to use the following code to set the quality:

                Graphics g = this.CreateGraphics();
                Bitmap bm = new Bitmap(this.Height, this.Width);
                bm.SetResolution(g.DpiX, g.DpiY);//set Resolution
                Graphics grap = Graphics.FromImage(bm);
                grap.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

    Regards,

    Moonlight


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.




    Monday, April 18, 2016 7:02 AM
  • I think:

    The bitmap you create when you do this.CreateGraphics() will be a copy of the window at the same dpi/resolution as the window on you rmonitor.

    You've already lost data if you up the resolution afterwards.

    You would need to draw the window at 600 dpi rather than 72 or 96 or whatever your window will be at.

    The solution here redraws the window at the required resolution.

    https://social.msdn.microsoft.com/Forums/windowsserver/en-US/66469764-4e0d-4599-9c86-150d51164c70/print-a-form-at-600dpi-rather-than-screen-resolution?forum=winforms

    It's often better, in my experience, to offer a report rather than print windows if the user wants better than screen resolution.

    Often, you don't want loads of stuff that goes in a window on a report and a4 is a different shape to most monitors.


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Monday, April 18, 2016 12:24 PM