MinMaxParagraphWidth.MinWidth Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the smallest paragraph width possible 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
A Double that represents the smallest paragraph width possible.
Examples
The following example shows how to use the MinWidth property to generate the minimum paragraph width for the formatted lines of text.
MinMaxParagraphWidth minMaxParaWidth =
formatter.FormatMinMaxParagraphWidth(customTextSource, 0, customTextParagraphProperties);
// Format each line of text from the text store and draw it.
while (textStorePosition < customTextSource.Text.Length)
{
// Create a textline from the text store using the TextFormatter object.
using (TextLine myTextLine = formatter.FormatLine(
customTextSource,
textStorePosition,
minMaxParaWidth.MinWidth,
customTextParagraphProperties,
null))
{
// Draw the formatted text into the drawing context.
myTextLine.Draw(drawingContext, linePosition, InvertAxes.None);
// Update the index position in the text store.
textStorePosition += myTextLine.Length;
// Update the line position coordinate for the displayed line.
linePosition.Y += myTextLine.Height;
}
}
Dim minMaxParaWidth As MinMaxParagraphWidth = formatter.FormatMinMaxParagraphWidth(customTextSource, 0, customTextParagraphProperties)
' Format each line of text from the text store and draw it.
Do While textStorePosition < customTextSource.Text.Length
' Create a textline from the text store using the TextFormatter object.
Using myTextLine As TextLine = formatter.FormatLine(customTextSource, textStorePosition, minMaxParaWidth.MinWidth, customTextParagraphProperties, Nothing)
' Draw the formatted text into the drawing context.
myTextLine.Draw(drawingContext, linePosition, InvertAxes.None)
' Update the index position in the text store.
textStorePosition += myTextLine.Length
' Update the line position coordinate for the displayed line.
linePosition.Y += myTextLine.Height
End Using
Loop
Remarks
The minimum paragraph width corresponds to the word that has the greatest width in the text content.
Applies to
GitHub पर हमारे साथ सहयोग करें
इस सामग्री का स्रोत GitHub पर पाया जा सकता है, जहाँ आप समस्याएँ बना और समीक्षा भी कर सकते हैं और अनुरोध खींच सकते हैं. अधिक जानकारी के लिए, हमारे योगदानकर्ता गाइड देखें.