MinMaxParagraphWidth Struct

Definizione

Rappresenta la maggiore e la minore larghezza possibili del paragrafo che può contenere il testo completo specificato.

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)
Ereditarietà
MinMaxParagraphWidth
Implementazioni

Esempio

Nell'esempio seguente viene illustrato come utilizzare la MinWidth proprietà per generare la larghezza minima del paragrafo per le righe formattate di testo.

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

Proprietà

MaxWidth

Ottiene la larghezza massima del paragrafo che può includere completamente il contenuto del testo specificato.

MinWidth

Ottiene la larghezza minima del paragrafo che può includere completamente il contenuto del testo specificato.

Metodi

Equals(MinMaxParagraphWidth)

Consente di determinare se l'oggetto CharacterBufferReference è uguale all'oggetto CharacterBufferReference corrente.

Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto CharacterBufferReference corrente.

GetHashCode()

Usato come funzione hash per CharacterBufferReference. Adatto per l'uso in algoritmi hash e in strutture dei dati, ad esempio una tabella hash.

Operatori

Equality(MinMaxParagraphWidth, MinMaxParagraphWidth)

Confronta due stringhe CharacterBufferReference per verificarne l'uguaglianza.

Inequality(MinMaxParagraphWidth, MinMaxParagraphWidth)

Confrontare due oggetti CharacterBufferReference per stabilirne la disuguaglianza.

Si applica a

Vedi anche