FlowDocument.IsHyphenationEnabled Propriedade

Definição

Recebe ou define um valor que indica se a hífenização automática das palavras está ativada ou desativada.

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

Valor de Propriedade

true se a quebra automática e hifenização das palavras estiver ativada; caso contrário, false. A predefinição é false.

Exemplos

O exemplo seguinte mostra como definir o IsHyphenationEnabled atributo de um FlowDocument elemento.

<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>

A figura seguinte mostra como o anterior FlowDocument se apresenta.

Captura de ecrã: hífen do FlowDocument ativado

A figura seguinte mostra como o mesmo FlowDocument renderiza com a definição padrão de IsHyphenationEnabled=false.

Captura de ecrã: FlowDocument com hífens desativados

O exemplo a seguir mostra como definir a propriedade IsHyphenationEnabled programaticamente.

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

Observações

A funcionalidade automática de hifenização de palavras permite que FlowDocument um detrique e hífenize palavras automaticamente, com base nas condições atuais de layout. Isto permite que palavras longas comecem numa linha e continuem na seguinte, e tende a conseguir uma distribuição mais uniforme do espaço em branco no texto justificado. As palavras são quebradas e com hífen, de acordo com as regras gramaticais padrão. A hífenização automática é particularmente eficaz quando combinada com uma disposição ótima de parágrafos (representada pela propriedade IsOptimalParagraphEnabled ).

Informação de Propriedade de Dependência

Item Value
Campo identificador IsHyphenationEnabledProperty
Propriedades dos metadados definidas como true AffectsMeasure, AffectsRender, Inherits

Aplica-se a