TextFormatter.FormatMinMaxParagraphWidth メソッド

定義

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

オーバーロード

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

public:
 abstract System::Windows::Media::TextFormatting::MinMaxParagraphWidth FormatMinMaxParagraphWidth(System::Windows::Media::TextFormatting::TextSource ^ textSource, int firstCharIndex, System::Windows::Media::TextFormatting::TextParagraphProperties ^ paragraphProperties);
public abstract System.Windows.Media.TextFormatting.MinMaxParagraphWidth FormatMinMaxParagraphWidth (System.Windows.Media.TextFormatting.TextSource textSource, int firstCharIndex, System.Windows.Media.TextFormatting.TextParagraphProperties paragraphProperties);
abstract member FormatMinMaxParagraphWidth : System.Windows.Media.TextFormatting.TextSource * int * System.Windows.Media.TextFormatting.TextParagraphProperties -> System.Windows.Media.TextFormatting.MinMaxParagraphWidth

パラメーター

textSource
TextSource

行のテキスト ソースを表す TextSource オブジェクト。A TextSource object that represents the text source for the line.

firstCharIndex
Int32

行の先頭の文字の文字インデックスを指定する Int32 値。An Int32 value that specifies the character index of the starting character in the line.

paragraphProperties
TextParagraphProperties

フロー方向、配置、インデントなど、段落のプロパティを表す TextParagraphProperties オブジェクト。A TextParagraphProperties object that represents paragraph properties, such as flow direction, alignment, or indentation.

戻り値

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す MinMaxParagraphWidth 値。A MinMaxParagraphWidth value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

次の例は、FormatMinMaxParagraphWidth メソッドを使用して、書式設定されたテキスト行の段落の最小幅を生成する方法を示しています。The following example shows how to use the FormatMinMaxParagraphWidth method 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

注釈

次のテキストでは、ソーステキストの最小の段落幅を使用します。これは、複数の行として表示されます。The following text uses the minimum paragraph width for the source text, which displays as multiple lines. 段落の最小幅は、最大の幅を持つ単語 (この場合は "ジャンプ" という単語) に対応します。The minimum paragraph width corresponds to the word that has the greatest width - in this case, the word "jumped". 合計幅が段落の最小幅を超えない限り、複数の単語が同じ行に表示されることに注意してください。Notice that multiple words can appear on the same line, as long as the total width does not exceed the minimum paragraph width.

段落の最小幅を使用したテキストフォーマッタText Formatter using the minimum paragraph width
段落の最小幅Minimum paragraph width

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。Returns a value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

public:
 abstract System::Windows::Media::TextFormatting::MinMaxParagraphWidth FormatMinMaxParagraphWidth(System::Windows::Media::TextFormatting::TextSource ^ textSource, int firstCharIndex, System::Windows::Media::TextFormatting::TextParagraphProperties ^ paragraphProperties, System::Windows::Media::TextFormatting::TextRunCache ^ textRunCache);
public abstract System.Windows.Media.TextFormatting.MinMaxParagraphWidth FormatMinMaxParagraphWidth (System.Windows.Media.TextFormatting.TextSource textSource, int firstCharIndex, System.Windows.Media.TextFormatting.TextParagraphProperties paragraphProperties, System.Windows.Media.TextFormatting.TextRunCache textRunCache);
abstract member FormatMinMaxParagraphWidth : System.Windows.Media.TextFormatting.TextSource * int * System.Windows.Media.TextFormatting.TextParagraphProperties * System.Windows.Media.TextFormatting.TextRunCache -> System.Windows.Media.TextFormatting.MinMaxParagraphWidth

パラメーター

textSource
TextSource

行のテキスト ソースを表す TextSource オブジェクト。A TextSource object that represents the text source for the line.

firstCharIndex
Int32

行の先頭の文字の文字インデックスを指定する Int32 値。An Int32 value that specifies the character index of the starting character in the line.

paragraphProperties
TextParagraphProperties

フロー方向、配置、インデントなど、段落のプロパティを表す TextParagraphProperties オブジェクト。A TextParagraphProperties object that represents paragraph properties, such as flow direction, alignment, or indentation.

textRunCache
TextRunCache

テキストのレイアウトのキャッシュ機構を表す TextRunCache オブジェクト。A TextRunCache object that represents the caching mechanism for the layout of text.

戻り値

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す MinMaxParagraphWidth 値。A MinMaxParagraphWidth value that represents the smallest and largest possible paragraph width that can fully contain the specified text content.

適用対象