Rich Edit controls are very flexible you can insert text of different formats, embed objects such as bitmaps and other graphics, have them wrap text to match the controls windows or the target printer, etc. Depending upon your point of view, printing a Rich Edit control is both simple and complicated.
First, let's look at the TRichEdit class's Print() method. On the surface, this looks like a great way to get the contents of a Rich Edit control onto paper. Add a print button or menu item and add the following line to the OnClick handler:
Click on the button/menu and the text from the control is printed. What could be simpler?
After the initial excitement subsides, you realize that there is no obvious way to control the margins on the printed page. Even if you solve that problem, there are several other limitations:
There must be a better way, you think. There is, but it is not pretty .
On to Part 2: Printing Rich Edit Controls
Copyright © 1998-2001 Thin Air Enterprises and Robert Dunn. All rights reserved.