Block.IsHyphenationEnabled 属性

定义

获取或设置一个值,该值指示是否启用文字的自动断字功能。

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

属性值

如果启用自动对文字进行断字和添加连字符,则为 true;否则为 false。 默认值为 false

示例

以下示例演示如何设置 IsHyphenationEnabled 元素的 Block 属性。

<FlowDocument
  TextAlignment="Justify" 
  IsOptimalParagraphEnabled="True"
  Background="LightGray"
  PageWidth="400" PageHeight="480"
>
  <Paragraph IsHyphenationEnabled="True">
    <Hyperlink NavigateUri="http://www.xbox.com/en-US/games/p/perfectdarkzero/default.htm">
      Perfect Dark Zero
    </Hyperlink>
  </Paragraph>
  <Paragraph IsHyphenationEnabled="True">
    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 IsHyphenationEnabled="True">
    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 IsHyphenationEnabled="True">
    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>

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

屏幕截图:已启用 FlowDocument 连字符

下图显示了同一示例如何使用默认设置 IsHyphenationEnabled=false呈现。

屏幕截图:具有禁用连字符的 FlowDocument

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

Paragraph par = new Paragraph();
par.IsEnabled = true;
Dim par As New Paragraph()
par.IsEnabled = True

注解

自动断字功能使 Block 元素能够根据当前布局条件自动断字和断字。 这使得长字从一行开始,并在下一行继续,并倾向于在对齐文本中实现更均匀的空白分布。 单词根据标准语法规则进行断字和断字符。

依赖项属性信息

标识符字段 IsHyphenationEnabledProperty
元数据属性设置为 true AffectsMeasure, AffectsRender, Inherits

适用于