Partager via


FlowDocument.IsHyphenationEnabled Propriété

Définition

Obtient ou définit une valeur qui indique si le trait d’union automatique des mots est activé ou désactivé.

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

Valeur de propriété

true si la rupture automatique et le trait d’union des mots sont activés ; sinon, false. La valeur par défaut est false.

Exemples

L’exemple suivant montre comment définir l’attribut IsHyphenationEnabled d’un FlowDocument élément.

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

La figure suivante montre comment le rendu précédent FlowDocument s’affiche.

Capture d’écran : Trait d’union FlowDocument activé Capture d’écran

La figure suivante montre comment le même FlowDocument rendu avec le paramètre par défaut de IsHyphenationEnabled=false.

Capture d’écran : FlowDocument avec traits d’union désactivés Capture d’écran

L’exemple suivant montre comment définir la IsHyphenationEnabled propriété par programmation.

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

Remarques

La fonctionnalité de trait d’union automatique permet d’interrompre FlowDocument et de traits d’union automatiquement les mots, en fonction des conditions de disposition actuelles. Cela permet aux mots longs de commencer sur une ligne et de continuer sur cette suivante, et tend à obtenir une distribution plus uniforme de l’espace blanc dans le texte justifié. Les mots sont rompus et traits d’union selon les règles de grammaire standard. Le trait d’union automatique est particulièrement efficace lorsqu’il est associé à une disposition de paragraphe optimale (représentée par la IsOptimalParagraphEnabled propriété).

Informations sur les propriétés de dépendance

Élément Valeur
Champ d’identificateur IsHyphenationEnabledProperty
Propriétés de métadonnées définies sur true AffectsMeasure, , AffectsRenderInherits

S’applique à