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.

enter image description here

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

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -