如何更改 RichTextBox 段落间距? [英] How do I change RichTextBox paragraph spacing?

查看:41
本文介绍了如何更改 RichTextBox 段落间距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 WPF 中使用 RichTextBox,并尝试将默认段落间距设置为 0(以便没有段落间距).虽然我可以在 XAML 中做到这一点,但如果可能的话,我想以编程方式实现它.有什么想法吗?

I am using a RichTextBox in WPF, and am trying to set the default paragraph spacing to 0 (so that there is no paragraph spacing). While I could do this in XAML, I would like to achieve it programmatically if possible. Any ideas?

推荐答案

我做到了风格(双关语缩进)

I did it with style (pun indented)

<RichTextBox  Margin="0,51,0,0" Name="mainTextBox" >
        <RichTextBox.Resources>
            <Style TargetType="{x:Type Paragraph}">
                <Setter Property="Margin" Value="0"/>
            </Style>
        </RichTextBox.Resources>
    </RichTextBox>

这篇关于如何更改 RichTextBox 段落间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆