MinMaxParagraphWidth Структура

Определение

Представляет самую малую и самую большую ширину абзаца, которая может полностью содержать указанное текстовое содержимое.

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)
Наследование
MinMaxParagraphWidth
Реализации

Примеры

В следующем примере показано, как использовать MinWidth свойство для создания минимальной ширины абзаца для отформатированных строк текста.

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

Свойства

Имя Описание
MaxWidth

Получает самую большую ширину абзаца, которая может полностью содержать указанное текстовое содержимое.

MinWidth

Получает наименьшую ширину абзаца, которая может полностью содержать указанное текстовое содержимое.

Методы

Имя Описание
Equals(MinMaxParagraphWidth)

Определяет, равен ли CharacterBufferReference текущий CharacterBufferReference объект.

Equals(Object)

Определяет, равен ли указанный объект текущему CharacterBufferReference объекту.

GetHashCode()

Служит хэш-функцией для CharacterBufferReference. Он подходит для использования в хэш-алгоритмах и структурах данных, таких как хэш-таблица.

Операторы

Имя Описание
Equality(MinMaxParagraphWidth, MinMaxParagraphWidth)

Сравните две CharacterBufferReference строки для равенства.

Inequality(MinMaxParagraphWidth, MinMaxParagraphWidth)

Сравните два CharacterBufferReference объекта для неравенства.

Применяется к

См. также раздел