Бөлісу құралы:


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 отрисовки с параметром IsHyphenationEnabled=falseпо умолчанию.

Снимок экрана: FlowDocument с отключенными дефисами: 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

Применяется к