Using a PrintDocument
and the PrintPage
event, Environment.Newline
is ignored, so the only way I found to print a newline is:
line = string.Empty;
yPos = topMargin + count * printFont.GetHeight(ev.Graphics)
ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, _
yPos, New StringFormat())
Is there a simpler way to print a newline?
As a side comment, printing with .Net seems to have regressed to an unnecessarily complex task. Why did they drop the nearly automatic printing that was in VB6 with the CommonDialog
?
This book helped me a lot on a printing task, hope you can find what you are looking for here.
http://www.merrioncomputing.com/Programming/Printing-a-NET-developers-guide-Part1.pdf
Alex.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.