vb.net - Text Wrapping when Printing -
i'm trying make sure words , characters on printdocument
go way page margins , wrap. @ moment wraps quite gap:
the red margin. want text go way margin, if exceeds, wrap it.
this printdocument
code:
private sub printdoc_printpage(sender object, e printpageeventargs) handles printdoc.printpage dim printfont new font(thetextbox.fontfamily.tostring(), convert.tosingle(thetextbox.fontsize)) dim charactersonpage integer = thetextbox.text.length dim linesperpage integer = thetextbox.linecount e.graphics.drawrectangle(pens.red, e.marginbounds) e.graphics.measurestring(stringtoprint, printfont, e.marginbounds.size, stringformat.genericdefault, charactersonpage, linesperpage) e.graphics.drawstring(stringtoprint, printfont, brushes.black, e.marginbounds, stringformat.genericdefault) stringtoprint = stringtoprint.substring(charactersonpage) e.hasmorepages = stringtoprint.length > 0 end sub
Comments
Post a Comment