如何在WPF C#中设置richtextbox中文本的行间距?

时间:2014-06-06 00:16:45

标签: c# wpf richtextbox flowdocument

当我使用richtextbox进行文本编辑时,行间距很大,但是当我在FlowDocument中打开相同的文本/文件时,它看起来非常好。有没有一种简单的方法来改变richtextbox中的行间距以及与FlowDocument的行间距匹配?

Paragraph paragraph = new Paragraph();
paragraph.Inlines.Add(dataContent);

FlowDocument document = new FlowDocument(paragraph);
selectedRTB.Document = document;
selectedTabItem.Content = selectedRTB;

1 个答案:

答案 0 :(得分:2)

   <RichTextBox >
        <FlowDocument>
            <Paragraph LineHeight="50">
                Paragraph1
            </Paragraph>
            <Paragraph LineHeight="20">
                Paragraph2
            </Paragraph>
        </FlowDocument >
    </RichTextBox>

试一试。