Introduction
A common question in the forums in the past has been how do I break up a long string
and print it using the standard MFC architecture. Above is an example project that does just that. You can enter a long string
to print in a MultiLine edit control. To see what the output would be like for your printer, you can select the Print Preview option from the file menu.
There are some drawbacks in the example in that it doesn't handle tabs correctly as it only uses CDC::TextOut()
when printing, and CDC::GetTextExtent()
when measuring whether the currently selected line will fit in one line, or needs to be broken up across multiple lines. This can be changed by yourselves as a programming exercise using the CDC::DrawText()
function.
I hope this example will help out beginners at printing.
Enjoy!