Specifies the display and layout information for text strings.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
|Aligns the text on the bottom of the bounding rectangle. Applied only when the text is a single line.|
|Removes the end of trimmed lines, and replaces them with an ellipsis.|
|Expands tab characters. The default number of characters per tab is eight. The , , and values cannot be used with .|
|Includes the font external leading in line height. Typically, external leading is not included in the height of a line of text.|
|Applies the default formatting, which is left-aligned.|
|Applies to Windows 2000 and Windows XP only: |
Ignores the ampersand (&) prefix character in the text. The letter that follows will not be underlined, but other mnemonic-prefix characters are still processed. For example, an input string of "A&bc&&d" with applied would result in output of "Abc&d".
Compare with and .
|Centers the text horizontally within the bounding rectangle.|
|Uses the system font to calculate text metrics.|
|Aligns the text on the left side of the clipping area.|
|Has no effect on the drawn text.|
|Allows the overhanging parts of glyphs and unwrapped text reaching outside the formatting rectangle to show.|
|Turns off processing of prefix characters. Typically, the ampersand (&) mnemonic-prefix character is interpreted as a directive to underscore the character that follows, and the double-ampersand (&&) mnemonic-prefix characters as a directive to print a single ampersand. By specifying , this processing is turned off. For example, an input string of "A&bc&&d" with applied would result in output of "A&bc&&d".|
Compare with and .
|Applies to Windows 98, Windows Me, Windows 2000, or Windows XP only:|
Prevents a line break at a double-wide character string, so that the line-breaking rule is equivalent to single-wide character strings. For example, increases the readability of icon labels in Korean windows. This value has no effect unless is also specified.
|Removes the center of trimmed lines and replaces it with an ellipsis.|
|Applies to Windows 2000 or Windows XP only: |
Draws only an underline at the position of the character following the ampersand (&) prefix character. Does not draw any other characters in the string. For example, an input string of "A&bc&&d" would result in output of " _ ".
Compare with and .
|Aligns the text on the right side of the clipping area.|
|Displays the text from right to left.|
|Displays the text in a single line.|
|Specifies the text should be formatted for display on a TextBox control.|
|Aligns the text on the top of the bounding rectangle.|
|Centers the text vertically, within the bounding rectangle.|
|Breaks the text at the end of a word.|
|Trims the line to the nearest word and an ellipsis is placed at the end of a trimmed line.|
|Preserves the clipping specified by a Graphics object. Applies only to methods receiving an IDeviceContext that is a Graphics.|
|Preserves the transformation specified by a Graphics. Applies only to methods receiving an IDeviceContext that is a Graphics.|
|Adds padding to the bounding rectangle to accommodate overhanging glyphs.|
|Does not add padding to the bounding rectangle.|
|Adds padding to both sides of the bounding rectangle.|
The following code example demonstrates how to use the enumeration. To run this example, paste the following code into a Windows Form. Call RenderText6 from the form's Paint event handler, passing e as PaintEventArgs.
Private Sub RenderText6(ByVal e As PaintEventArgs) Dim flags As TextFormatFlags = TextFormatFlags.Bottom Or _ TextFormatFlags.EndEllipsis TextRenderer.DrawText(e.Graphics, _ "This is some text that will be clipped at the end.", _ Me.Font, New Rectangle(10, 10, 100, 50), SystemColors.ControlText, flags) End Sub
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.