RichTextBox vbLF problems

John H.

Member
Joined
Mar 31, 2008
Messages
14
Programming Experience
Beginner
I am trying to create a viewer for files with large (sometimes over 2,000 characters) records. I want to use the rich text box control and show a given record in rows of 100 characters each. I have set the font to Courier New and sized the RTB appropriately to show the records correctly. However, if there is a record with 80 consecutive alpha characters followed by a space, then 120 consecutive alpha characters, the RTB separates the line at the space, as if there were a vbLF there. This happens in other cases, but I haven’t been able to figure out how the RTB decides when to break the line.

Is there a way I can tell the RTB to break a line only when there is actually a vbLF? Can you at least tell me how RTB decides when to break? Any suggestions will be appreciated.

TIA, John
 
Didn't help

Please note that I said "as if there were a vbLF there". Whether WordWrap is true or false doesn't fix the problem. I need each line of the RTB to be 100 characters. I can acineve this by inserting my own vbLF, but that makes obtaining a cursor position (SelectionStart) difficult. I need a way to have RTB display a 2K-byte record in lines of 100 characters.
 
Then you either need to prepare the text for that before displaying it in RTB, or work with the unmanaged EM_SETWORDBREAKPROC Message (Windows) to provide custom wordwrap behaviour.
 
Back
Top