Paragraph Formatting

Equipped with the ability to select and create logical fonts, it’s time to try our hand at text formatting. The process involves placing each line of text within margins in one of four ways: aligned on the left margin, aligned on the right margin, centered between the margins, or justified—that is, running from one margin to the other, with equal spaces between the words. For the first three jobs, you can use the DrawText function with the DT_ WORDBREAK argument, but this approach has limitations. For instance, you can’t determine what part of the text DrawText was able to fit within the rectangle. DrawText is convenient for some simple jobs, but for more complex formatting tasks, you’ll probably want to employ TextOut.

Simple ...

Get Programming Windows®, Fifth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.