With the Rich Text Box, you will have to do a similar thing (measuring, etc. ) but with a much finer scale. You will need to go through looking at the formatting of each word, or even letter - depends on how you are implementing the rich text box.
Once you've measured it, you can see if it fits on the line or needs to go to the next line. If it goes on the next line, does it go on the next page...that sort of thing. It's a bit more complcated if you have different fonts or font sizes - you may have to keep measuring words until a line is created, so you can see how much space (vertical and horizontal) the 'line' takes up, and plot each word in that line all at one go. Again, you may need to do this character by character.
The process is pretty much the same as what Tall Dude has posted.
Once you've figured out the technique, it's actually not that hard, and doesn't take as long as you might think (spooling all this stuff to the printer takes way longer).
If you want a dirty, lazy way of doing it, you could try creating a temporary rich text file and activating wordpad as a process.
|