有没有办法在流文档或system.windows.control RichTextBox(wpf)中创建悬挂缩进?如果它将在流文档中工作,当我将其加载到RichTextBox中以显示它是否会保持它的形式?
答案 0 :(得分:6)
在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 Documents - Indenting Paragraphs
希望这有帮助,尊重