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.

適用於

另請參閱