Создание Висящего отступа в поточном документе или в WPF RichTextBox - PullRequest
2 голосов
/ 17 марта 2011

Есть ли способ создать висячий отступ либо в документе потока, либо в system.windows.control RichTextBox (wpf)? и если он будет работать в потоке документа, когда я загружу его в RichTextBox для отображения, он сохранит свою форму?

1 Ответ

6 голосов
/ 17 марта 2011

В защите абзаца FlowDocument вы можете установить левое поле равным значению отступа, а затем установить TextIndent на отрицательное значение этого значения. Ниже приведен пример:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition />
    </Grid.RowDefinitions>

    <FlowDocumentScrollViewer>
        <FlowDocument>
            <Section>
                <Paragraph TextIndent="-30" Margin="30,20,0,0">
                    The first line of this paragraph is not indented, but the rest of the lines will be indented by 30 units. The first line of this paragraph is not indented, but the rest of the lines will be indented by 30 units.
                </Paragraph>
            </Section>
        </FlowDocument>
    </FlowDocumentScrollViewer>

    <RichTextBox Grid.Row="1">
        <FlowDocument>
            <Section>
                <Paragraph TextIndent="-60" Margin="60,20,0,0">
                    The first line of this paragraph is not indented, but the rest of the lines will be indented by 60 units. The first line of this paragraph is not indented, but the rest of the lines will be indented by 60 units.
                </Paragraph>
            </Section>
        </FlowDocument>
    </RichTextBox>
</Grid>

подробности об отступах здесь Документы WPF - отступы

надеюсь, это поможет, с уважением

...