Answered by:
How can I print the winform in high quality?

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
-
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.
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.
- Proposed as answer by Moonlight ShengMicrosoft contingent staff Monday, April 25, 2016 1:55 AM
- Marked as answer by Barry Wang Friday, May 6, 2016 1:59 AM
Monday, April 18, 2016 12:24 PM
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.
- Edited by Moonlight ShengMicrosoft contingent staff Monday, April 18, 2016 7:13 AM
- Proposed as answer by Moonlight ShengMicrosoft contingent staff Monday, April 25, 2016 1:56 AM
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.
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.
- Proposed as answer by Moonlight ShengMicrosoft contingent staff Monday, April 25, 2016 1:55 AM
- Marked as answer by Barry Wang Friday, May 6, 2016 1:59 AM
Monday, April 18, 2016 12:24 PM