a simple printing question, many thanks!
if I print a textBox or richTextbox's text, the printer don't automatic change to next line, even the textbox is set to auto-wrap, the printer print all the text from a textBox in one line!!! unless I manually press Enter in the textBox field.part of my code:
while(currentLine < linesPerPage && ((line=myReader.ReadLine()) != null))
{
currentY = getCurrentY(currentLine, topMargin, bodyFontHeight);
ev.Graphics.DrawString(line, bodyFont,defaultBrush, bodyR.Left, currentY);
currentLine++;
}
many thanks for reading my question!
The RichTextBox Lines property is not affected by the value of the WordWrap property. That is, Lines[0] will return the same thing regardless of WordWrap being true or false. Only the display of the text is different, not the text itself.
This is necessary to preserve the text. If the text was changed when WordWrap was set to true, the control would not know which line breaks to remove when WOrdWrap was set back to false.
In order ot print this, you'll need to measure the stings yourself and manually add new lines to the printed page.
HTH
- mike