How to print a newline in c#
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. Wh开发者_StackOverflow社区y 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.
精彩评论