TextFormatter.FormatMinMaxParagraphWidth メソッド

定義

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。

オーバーロード

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す値を返します。

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
Public MustOverride Function FormatMinMaxParagraphWidth (textSource As TextSource, firstCharIndex As Integer, paragraphProperties As TextParagraphProperties) As MinMaxParagraphWidth

パラメーター

textSource
TextSource

行のテキスト ソースを表す TextSource オブジェクト。

firstCharIndex
Int32

行の先頭の文字の文字インデックスを指定する Int32 値。

paragraphProperties
TextParagraphProperties

フロー方向、配置、インデントなど、段落のプロパティを表す TextParagraphProperties オブジェクト。

戻り値

MinMaxParagraphWidth

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す MinMaxParagraphWidth 値。

次の例は、このメソッドを FormatMinMaxParagraphWidth 使用して、書式設定されたテキスト行の最小段落幅を生成する方法を示しています。

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

注釈

次のテキストでは、ソース テキストの段落の最小幅を使用します。これは複数行として表示されます。 段落の最小幅は、最も幅が大きい単語 (この場合は "jumped" という単語) に対応します。 全体の幅が段落の最小幅を超えない限り、複数の単語を同じ行に表示できることに注意してください。

段落の最小幅を使用するテキスト フォーマッタ
段落の最小幅

適用対象

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, 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);
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
Public MustOverride Function FormatMinMaxParagraphWidth (textSource As TextSource, firstCharIndex As Integer, paragraphProperties As TextParagraphProperties, textRunCache As TextRunCache) As MinMaxParagraphWidth

パラメーター

textSource
TextSource

行のテキスト ソースを表す TextSource オブジェクト。

firstCharIndex
Int32

行の先頭の文字の文字インデックスを指定する Int32 値。

paragraphProperties
TextParagraphProperties

フロー方向、配置、インデントなど、段落のプロパティを表す TextParagraphProperties オブジェクト。

textRunCache
TextRunCache

テキストのレイアウトのキャッシュ機構を表す TextRunCache オブジェクト。

戻り値

MinMaxParagraphWidth

指定したテキスト コンテンツをすべて格納できる最小および最大の段落幅を表す MinMaxParagraphWidth 値。

適用対象