Upravit

Sdílet prostřednictvím


FormattedText.MinWidth Property

Definition

Gets the smallest possible text width that can fully contain the specified text content.

public:
 property double MinWidth { double get(); };
public double MinWidth { get; }
member this.MinWidth : double
Public ReadOnly Property MinWidth As Double

Property Value

The minimum text width of the text source, provided in device-independent units (1/96th inch per unit).

Examples

The following example shows how to use the MinWidth property to generate the minimum text width for the formatted lines of text.

// Get the minimimum line width for the text content -- that is, the widest word.
double minWidth = formattedText.MinWidth;

// Set the maximum text width to the widest word in the text content.
formattedText.MaxTextWidth = minWidth;
' Get the minimimum line width for the text content -- that is, the widest word.
Dim minWidth As Double = formattedText.MinWidth

' Set the maximum text width to the widest word in the text content.
formattedText.MaxTextWidth = minWidth

Remarks

The following illustrated text uses the minimum text width for the source text, which displays as multiple lines. The minimum text width corresponds to the word that has the greatest width - in this case, the word "jumped". Notice that multiple words can appear on the same line, as long as their total width does not exceed the minimum text width.

Text Formatter using the minimum paragraph width Minimum text width

If the value passed to MaxTextWidth is greater than or equal to the value of MinWidth, the text is formatted without ellipsis characters.

Applies to