FlowDocument.IsOptimalParagraphEnabled Właściwość

Definicja

Pobiera lub ustawia wartość wskazującą, czy optymalny układ akapitu jest włączony, czy wyłączony.

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

Wartość właściwości

Boolean

true jeśli jest włączony optymalny układ akapitu; w przeciwnym razie , false. Wartość domyślna to false.

Przykłady

W poniższym przykładzie pokazano, jak ustawić IsOptimalParagraphEnabled atrybut FlowDocument elementu.

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

Na poniższej ilustracji przedstawiono sposób renderowania powyższych FlowDocument elementów.

Zrzut ekranu: łącznik FlowDocument jest włączony

Na poniższej ilustracji pokazano, jak to samo FlowDocument jest renderowane przy użyciu domyślnego IsOptimalParagraphEnabled=falseustawienia .

Zrzut ekranu: FlowDocument z wyłączonymi łącznikami

W poniższym przykładzie pokazano, jak programowo ustawić IsOptimalParagraphEnabled właściwość.

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

Uwagi

Optymalny układ akapitu to funkcja, która określa akapity w FlowDocument taki sposób, że odstępy są rozmieszczone tak równomiernie, jak to możliwe. Teoretycznie zapewnia to zoptymalizowane środowisko odczytu, eliminując rozpraszanie białych znaków, które mogą wystąpić z tekstem uzasadnionym wierszem i innymi procedurami układu. Optymalny układ akapitu jest szczególnie skuteczny w przypadku automatycznego dzielenia wyrazów (reprezentowanego IsHyphenationEnabled przez właściwość).

Informacje dotyczące właściwości zależności

Pole identyfikatora IsOptimalParagraphEnabledProperty
Właściwości metadanych ustawione na true AffectsMeasure

Dotyczy