String Alignment and Wrapping

In addition to drawing single lines of text, you can also wrap a larger amount of text within a defined rectangle. To accomplish this, you need to create a StringFormat object for the purpose of defining how you want the text to be wrapped.

The StringFormat object has two useful properties for controlling the wrapping. These properties are FormatFlags and Alignment. The FormatFlags property is based on the StringFormatFlags enumeration data type. Table 26.3 shows the values defined in this enumeration along with a brief explanation.

Table 26.3. StringFormatFlags Enumeration Values
Name Description
DirectionRightToLeft ...

Get Visual Basic® .NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.