MinMaxParagraphWidth 结构

定义

表示可完全包含所指定文本内容的最小和最大可能的段落宽度。Represents the smallest and largest possible paragraph width that can fully contain the specified text content.

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 属性生成格式化文本行的最小段落宽度。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

属性

MaxWidth

获取可完全包含所指定文本内容的最大可能的段落宽度。Gets the largest paragraph width possible that can fully contain the specified text content.

MinWidth

获取可完全包含所指定文本内容的最小可能的段落宽度。Gets the smallest paragraph width possible that can fully contain the specified text content.

方法

Equals(MinMaxParagraphWidth)

确定 CharacterBufferReference 是否等于当前的 CharacterBufferReference 对象。Determines whether the CharacterBufferReference is equal to the current CharacterBufferReference object.

Equals(Object)

确定指定的对象是否等于当前 CharacterBufferReference 对象。Determines whether the specified object is equal to the current CharacterBufferReference object.

GetHashCode()

用作 CharacterBufferReference 的哈希函数。Serves as a hash function for CharacterBufferReference. 它适用于哈希算法和数据结构(如哈希表)。It is suitable for use in hashing algorithms and data structures such as a hash table.

运算符

Equality(MinMaxParagraphWidth, MinMaxParagraphWidth)

比较两个 CharacterBufferReference 字符串是否相等。Compare two CharacterBufferReference strings for equality.

Inequality(MinMaxParagraphWidth, MinMaxParagraphWidth)

比较两个 CharacterBufferReference 对象是否不相等。Compare two CharacterBufferReference objects for inequality.

适用于

另请参阅