June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to parse a large block of text into distinct lines that fit on a page.
Use the Graphics.DrawString method overload that accepts a bounding rectangle. Or, if you need custom wrapping ability, write code that moves through the text word by word and measures it using the Graphics.MeasureString method until the line exceeds a set threshold.
Often, you’ll need to break a large block of text into separate lines that can be printed individually on a page. In .NET, you can take two approaches: one that performs the wrapping for you, and one by which your code controls the wrapping process.
To use automatic wrapping, you simply need to use the version of the Graphics.DrawString method that accepts a bounding ...
Read now
Unlock full access