MinMaxParagraphWidth.MinWidth 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取可完全包含所指定文本内容的最小可能的段落宽度。
public:
property double MinWidth { double get(); };
public double MinWidth { get; }
member this.MinWidth : double
Public ReadOnly Property MinWidth As Double
属性值
一个 Double,表示最小可能的段落宽度。
示例
下面的示例演示如何使用 MinWidth 属性为带格式的文本行生成最小段落宽度。
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
注解
最小段落宽度对应于文本内容中宽度最大的单词。