MinMaxParagraphWidth Struct-datatyp

Definition

Representerar den minsta och största möjliga styckebredden som helt kan innehålla det angivna textinnehållet.

public value class MinMaxParagraphWidth : IEquatable<System::Windows::Media::TextFormatting::MinMaxParagraphWidth>
public struct MinMaxParagraphWidth : IEquatable<System.Windows.Media.TextFormatting.MinMaxParagraphWidth>
type MinMaxParagraphWidth = struct
Public Structure MinMaxParagraphWidth
Implements IEquatable(Of MinMaxParagraphWidth)
Arv
MinMaxParagraphWidth
Implementeringar

Exempel

I följande exempel visas hur du använder MinWidth egenskapen för att generera minsta styckebredd för de formaterade textraderna.

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

Egenskaper

Name Description
MaxWidth

Hämtar största möjliga styckebredd som helt kan innehålla det angivna textinnehållet.

MinWidth

Hämtar minsta möjliga styckebredd som helt kan innehålla det angivna textinnehållet.

Metoder

Name Description
Equals(MinMaxParagraphWidth)

Avgör om är lika med CharacterBufferReference det aktuella CharacterBufferReference objektet.

Equals(Object)

Avgör om det angivna objektet är lika med det aktuella CharacterBufferReference objektet.

GetHashCode()

Fungerar som en hash-funktion för CharacterBufferReference. Den är lämplig för användning i hash-algoritmer och datastrukturer, till exempel en hash-tabell.

Operatorer

Name Description
Equality(MinMaxParagraphWidth, MinMaxParagraphWidth)

Jämför två CharacterBufferReference strängar för likhet.

Inequality(MinMaxParagraphWidth, MinMaxParagraphWidth)

Jämför två CharacterBufferReference objekt för ojämlikhet.

Gäller för

Se även