Taal

TextFormatter.FormatMinMaxParagraphWidth Methode

Definitie

Retourneert een waarde die de kleinste en grootste alineabreedte aangeeft die de opgegeven tekstinhoud volledig kan bevatten.

Overloads

Name Description
FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

Retourneert een waarde die de kleinste en grootste alineabreedte aangeeft die de opgegeven tekstinhoud volledig kan bevatten.

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

Retourneert een waarde die de kleinste en grootste alineabreedte aangeeft die de opgegeven tekstinhoud volledig kan bevatten.

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

Retourneert een waarde die de kleinste en grootste alineabreedte aangeeft die de opgegeven tekstinhoud volledig kan bevatten.

public:
 abstract System::Windows::Media::TextFormatting::MinMaxParagraphWidth FormatMinMaxParagraphWidth(System::Windows::Media::TextFormatting::TextSource ^ textSource, int firstCharIndex, System::Windows::Media::TextFormatting::TextParagraphProperties ^ paragraphProperties);
public abstract System.Windows.Media.TextFormatting.MinMaxParagraphWidth FormatMinMaxParagraphWidth(System.Windows.Media.TextFormatting.TextSource textSource, int firstCharIndex, System.Windows.Media.TextFormatting.TextParagraphProperties paragraphProperties);
abstract member FormatMinMaxParagraphWidth : System.Windows.Media.TextFormatting.TextSource * int * System.Windows.Media.TextFormatting.TextParagraphProperties -> System.Windows.Media.TextFormatting.MinMaxParagraphWidth
Public MustOverride Function FormatMinMaxParagraphWidth (textSource As TextSource, firstCharIndex As Integer, paragraphProperties As TextParagraphProperties) As MinMaxParagraphWidth

Parameters

textSource
TextSource

Een TextSource object dat de tekstbron voor de regel vertegenwoordigt.

firstCharIndex
Int32

Een Int32 waarde die de tekenindex van het beginteken in de regel aangeeft.

paragraphProperties
TextParagraphProperties

Een TextParagraphProperties object dat alinea-eigenschappen vertegenwoordigt, zoals stroomrichting, uitlijning of inspringing.

Retouren

Een MinMaxParagraphWidth waarde die de kleinste en grootst mogelijke alineabreedte vertegenwoordigt die de opgegeven tekstinhoud volledig kan bevatten.

Voorbeelden

In het volgende voorbeeld ziet u hoe u de FormatMinMaxParagraphWidth methode gebruikt om de minimale alineabreedte te genereren voor de opgemaakte regels tekst.

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

Opmerkingen

De volgende tekst gebruikt de minimale alineabreedte voor de brontekst, die als meerdere regels wordt weergegeven. De minimale alineabreedte komt overeen met het woord met de grootste breedte, in dit geval het woord 'gesprongen'. U ziet dat meerdere woorden op dezelfde regel kunnen worden weergegeven, zolang de totale breedte niet groter is dan de minimale alineabreedte.

Tekstopmaak met de minimale alineabreedte Minimale alineabreedte

Van toepassing op

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

Retourneert een waarde die de kleinste en grootste alineabreedte aangeeft die de opgegeven tekstinhoud volledig kan bevatten.

public:
 abstract System::Windows::Media::TextFormatting::MinMaxParagraphWidth FormatMinMaxParagraphWidth(System::Windows::Media::TextFormatting::TextSource ^ textSource, int firstCharIndex, System::Windows::Media::TextFormatting::TextParagraphProperties ^ paragraphProperties, System::Windows::Media::TextFormatting::TextRunCache ^ textRunCache);
public abstract System.Windows.Media.TextFormatting.MinMaxParagraphWidth FormatMinMaxParagraphWidth(System.Windows.Media.TextFormatting.TextSource textSource, int firstCharIndex, System.Windows.Media.TextFormatting.TextParagraphProperties paragraphProperties, System.Windows.Media.TextFormatting.TextRunCache textRunCache);
abstract member FormatMinMaxParagraphWidth : System.Windows.Media.TextFormatting.TextSource * int * System.Windows.Media.TextFormatting.TextParagraphProperties * System.Windows.Media.TextFormatting.TextRunCache -> System.Windows.Media.TextFormatting.MinMaxParagraphWidth
Public MustOverride Function FormatMinMaxParagraphWidth (textSource As TextSource, firstCharIndex As Integer, paragraphProperties As TextParagraphProperties, textRunCache As TextRunCache) As MinMaxParagraphWidth

Parameters

textSource
TextSource

Een TextSource object dat de tekstbron voor de regel vertegenwoordigt.

firstCharIndex
Int32

Een Int32 waarde die de tekenindex van het beginteken in de regel aangeeft.

paragraphProperties
TextParagraphProperties

Een TextParagraphProperties object dat alinea-eigenschappen vertegenwoordigt, zoals stroomrichting, uitlijning of inspringing.

textRunCache
TextRunCache

Een TextRunCache object dat het cachemechanisme vertegenwoordigt voor de indeling van tekst.

Retouren

Een MinMaxParagraphWidth waarde die de kleinste en grootst mogelijke alineabreedte vertegenwoordigt die de opgegeven tekstinhoud volledig kan bevatten.

Van toepassing op