Sends formatted text in a RichEdit control to a device for printing.
RichEdit.SelPrint(hDc)
RichEdit.SelPrintRect(hDc, l, t, w, h)
hDc:Handle
l, t, w, h:Single exp
If text is selected in the RichEdit control, the SelPrint method sends only the selected text to the target device. If no text is selected, the entire contents of the RichEdit are sent to the target device.
The SelPrint method does not print text from the RichEdit control. Rather, it sends a copy of formatted text to a device which can print the text.
SelPrintRect(hDc, l, t, w, h) prints a portion of a rich edit control's contents, as previously formatted for a device hDc, to a rectangle area of that device. The rectangle is specified in twips with l (left), t (top), w (width), and h (height) parameters. The returns value of SelPrintRect is the index of the first character that doesn't fit the rectangle.
Lprint "";
rtf1.SelPrint(Printer.hDC)
Example 2
StartDoc "Test"
StartPage
rtf1.SelPrintRect(Printer.hDC, 0, 0, 2000, 2000)
EndPage
EndDoc
If you use the Printer object as the destination of the text from the RichEdit control, you must first initialize the device context of the Printer object by printing something like a zero-length string.
Problems have been reported with both SelPrint and SelPrintRect either just not printing or, more seriously, causing the program to freeze. There are currently no workarounds to these problems.
{Created by Sjouke Hamstra; Last updated: 23/04/2014 by James Gaite}