共用方式為


FlowDocument.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 專案的 屬性 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 連字號

下圖顯示相同的 FlowDocument 轉譯方式,其預設設定為 =IsHyphenationEnabledfalse

螢幕擷取畫面:具有停用連字號的 FlowDocument

下列範例示範如何以程式設計方式設定 IsHyphenationEnabled 屬性。

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 根據目前的版面配置條件,自動中斷和斷字字。 這可讓長字從一行開始,並繼續進行下一行,而且通常會在對齊文字中達到更平均的空白字元分佈。 文字會根據標準文法規則中斷和斷字。 與屬性所代表 IsOptimalParagraphEnabled 的最佳段落配置 (結合時,自動斷字特別有效) 。

相依性屬性資訊

識別碼欄位 IsHyphenationEnabledProperty
中繼資料屬性設定為 true AffectsMeasure, AffectsRender, Inherits

適用於