I’m sure this is a common problem, I don’t know if there is a common solution. My problem is when the user is viewing said multi-line text box in the GUI they can just scroll down, not a problem. When I come to print however, certain text occasionally ends up going off the bottom of the given area for that text box.
We’ll keep it simple and say it is not a rich text box so the user can’t choose a larger font which may therefore go off the page. hmmph cross that bride if I need to =)
So I considered;
Using a character limit but then if you just return carriage a number of times, this would end up going off the bottom.
Or a ‘row’ limit which i’m not entirely sure how to implement but didn’t seem right either
Finally I am coming to the conclusion that when you print said multi-line text box you must just expand the area on the printed document to fit whatever text has been entered. If this is the most elegant solution can anybody point me in the right direction for implementing such a feature?
Think of a notes field where the user could type as much as they wanted and the intention is to make sure all that is typed is printed.
Are you calling
yourTextBox.DrawToBitMap? All that does is create a bitmap of what appears on the screen, it does not perform printer output, line layout, line breaks, printer fonts, margins, orientation, pagination, or anything else to do with printing.If you want to send text to a printer, handling all the features mentioned above, you will have to use the
System.Drawing.Printing.PrintDocumentclass and deal with all the things printers require that textBoxes do for you.