TextFormatter.FormatMinMaxParagraphWidth Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mengembalikan nilai yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan.
Overload
| Nama | Deskripsi |
|---|---|
| FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties) |
Mengembalikan nilai yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan. |
| FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache) |
Mengembalikan nilai yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan. |
FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties)
Mengembalikan nilai yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan.
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
Parameter
- textSource
- TextSource
Objek TextSource yang mewakili sumber teks untuk baris.
- paragraphProperties
- TextParagraphProperties
Objek TextParagraphProperties yang mewakili properti paragraf, seperti arah alur, perataan, atau indentasi.
Mengembalikan
Nilai MinMaxParagraphWidth yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan.
Contoh
Contoh berikut menunjukkan cara menggunakan FormatMinMaxParagraphWidth metode untuk menghasilkan lebar paragraf minimum untuk baris teks yang diformat.
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
Keterangan
Teks berikut menggunakan lebar paragraf minimum untuk teks sumber, yang ditampilkan sebagai beberapa baris. Lebar paragraf minimum sesuai dengan kata yang memiliki lebar terbesar - dalam hal ini, kata "melompat". Perhatikan bahwa beberapa kata dapat muncul pada baris yang sama, selama lebar total tidak melebihi lebar paragraf minimum.
Lebar paragraf minimum
Berlaku untuk
FormatMinMaxParagraphWidth(TextSource, Int32, TextParagraphProperties, TextRunCache)
Mengembalikan nilai yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan.
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
Parameter
- textSource
- TextSource
Objek TextSource yang mewakili sumber teks untuk baris.
- paragraphProperties
- TextParagraphProperties
Objek TextParagraphProperties yang mewakili properti paragraf, seperti arah alur, perataan, atau indentasi.
- textRunCache
- TextRunCache
Objek TextRunCache yang mewakili mekanisme penembolokan untuk tata letak teks.
Mengembalikan
Nilai MinMaxParagraphWidth yang mewakili lebar paragraf terkecil dan terbesar yang dapat sepenuhnya berisi konten teks yang ditentukan.