FlowDocument.IsOptimalParagraphEnabled 属性

定义

获取或设置一个值,该值指示是否启用最佳段落布局功能。

public:
 property bool IsOptimalParagraphEnabled { bool get(); void set(bool value); };
public bool IsOptimalParagraphEnabled { get; set; }
member this.IsOptimalParagraphEnabled : bool with get, set
Public Property IsOptimalParagraphEnabled As Boolean

属性值

Boolean

如果启用最佳段落布局,则为 true;否则为 false。 默认值为 false

示例

以下示例演示如何设置 IsOptimalParagraphEnabled 元素的属性 FlowDocument

<FlowDocumentReader>
  <FlowDocument
    TextAlignment="Justify" 
    IsHyphenationEnabled="True"
    IsOptimalParagraphEnabled="True"
    Background="LightGray"
    PageWidth="400" PageHeight="480"
  >
    <Paragraph>
      <Hyperlink NavigateUri="http://www.xbox.com/en-US/games/p/perfectdarkzero/default.htm">
        Perfect Dark Zero
      </Hyperlink>
    </Paragraph>
    <Paragraph>
      Joanna Dark returns in the Xbox 360 exclusive <Bold><Italic>Perfect Dark Zero</Italic></Bold>, the 
      prequel to the internationally award-winning and multi-million selling first-person shooter 
      <Italic>Perfect Dark</Italic> from famed game developer Rare.
    </Paragraph>
    <Paragraph>
      A secret war has begun between shadowy corporations bent on world domination. Joanna Dark and her father 
      Jack are caught up in the fight for the future of the planet. A routine bounty hunting mission rips open 
      a global conspiracy that will change Joanna's destiny—forever.
    </Paragraph>
    <Paragraph>
      Guide Joanna Dark on her journey to become the perfect agent. Featuring a compelling and captivating story, 
      <Italic>Perfect Dark Zero</Italic> plunges you into a world of corporate espionage and conspiracy. The title 
      merges the excitement and intrigue of its predecessor with revolutionary game design, cutting-edge online play,
      and amazing graphics to deliver an experience that defines next-generation gaming and entertainment...
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

下图显示了上述 FlowDocument 呈现方式。

屏幕快照:启用连字符的 FlowDocument

下图显示了与默认设置IsOptimalParagraphEnabled=false相同的FlowDocument呈现方式。

屏幕快照:具有禁用的连字符的 FlowDocument

以下示例演示如何以编程方式设置 IsOptimalParagraphEnabled 属性。

FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));

// Enable automatic hyphenation.
flowDoc.IsHyphenationEnabled = true;
// Enable optimal paragraph layout.
flowDoc.IsOptimalParagraphEnabled = true;
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))

' Enable automatic hyphenation.
flowDoc.IsHyphenationEnabled = True
' Enable optimal paragraph layout.
flowDoc.IsOptimalParagraphEnabled = True

注解

最佳段落布局是一项功能,用于布局段落, FlowDocument 以便尽可能均匀地分布空白。 从理论上讲,这通过消除行对齐文本和其他布局例程可能发生的分心空白,从而提供优化的阅读体验。 最佳段落布局与属性) 表示 IsHyphenationEnabled 的自动连字符 (耦合时,效果特别有效。

依赖项属性信息

标识符字段 IsOptimalParagraphEnabledProperty
元数据属性设置为 true AffectsMeasure

适用于