Aracılığıyla paylaş


TextFormatter.FormatMinMaxParagraphWidth Yöntem

Tanım

Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden bir değer döndürür.

Aşırı Yüklemeler

Name Description
FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden bir değer döndürür.

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden bir değer döndürür.

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)

Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden bir değer döndürür.

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

Parametreler

textSource
TextSource

TextSource Satırın metin kaynağını temsil eden nesne.

firstCharIndex
Int32

Int32 Satırdaki başlangıç karakterinin karakter dizinini belirten değer.

paragraphProperties
TextParagraphProperties

TextParagraphProperties Akış yönü, hizalama veya girintileme gibi paragraf özelliklerini temsil eden nesne.

Döndürülenler

MinMaxParagraphWidth Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden değer.

Örnekler

Aşağıdaki örnekte, biçimlendirilmiş metin satırları için en düşük paragraf genişliğini oluşturmak üzere yönteminin nasıl kullanılacağı FormatMinMaxParagraphWidth gösterilmektedir.

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

Açıklamalar

Aşağıdaki metin, kaynak metin için en düşük paragraf genişliğini kullanır ve bu da birden çok satır olarak görüntülenir. En düşük paragraf genişliği, en büyük genişliğe sahip sözcüğe karşılık gelir - bu örnekte "atlandı" sözcüğü. Toplam genişlik en düşük paragraf genişliğini aşmadığı sürece aynı satırda birden çok sözcüğün görünebileceğine dikkat edin.

En düşük paragraf genişliğini kullanan En düşük paragraf genişliği

Şunlara uygulanır

FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)

Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden bir değer döndürür.

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

Parametreler

textSource
TextSource

TextSource Satırın metin kaynağını temsil eden nesne.

firstCharIndex
Int32

Int32 Satırdaki başlangıç karakterinin karakter dizinini belirten değer.

paragraphProperties
TextParagraphProperties

TextParagraphProperties Akış yönü, hizalama veya girintileme gibi paragraf özelliklerini temsil eden nesne.

textRunCache
TextRunCache

TextRunCache Metin düzeni için önbelleğe alma mekanizmasını temsil eden nesne.

Döndürülenler

MinMaxParagraphWidth Belirtilen metin içeriğini tam olarak içerebilen mümkün olan en küçük ve en büyük paragraf genişliğini temsil eden değer.

Şunlara uygulanır