如何限制每一条线最多83个字符RichTextBox的中
-
11-07-2019 - |
题
林试图使使用WPF的RichTextBox和工具栏,的最近的问题,以便一个的MSWord的娱乐如下:
在的MSWord文件...
...与字体家族宋体,11,对齐一行包含95个字符 ......与字体家族宋体,11,对齐,粗体一行包含83个字符
约边距 它更建议将每行的利润或限制字符工作? 因为当用户的输入。或anothers ASCII至极大小比其他的人,在单行“更改”最多字符数短。 所以,如果使用利润率是最propertly - ?在WPF的RichTextBox如何管理利润
谢谢!
解决方案
尝试每行听起来像恶梦我限制字符。你最好摆脱了ControlTemplate
默认RichTextBox
的,所以你只是有文字,然后设置你的Margin
的RichTextBox
使文本在中间的“漂浮”:
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ScrollViewer>
<RichTextBox Margin="30,0">
<RichTextBox.Template>
<ControlTemplate TargetType="{x:Type RichTextBox}">
<Border x:Name="PART_ContentHost" Margin="2" Background="Transparent" BorderBrush="Transparent"/>
</ControlTemplate>
</RichTextBox.Template>
</RichTextBox>
</ScrollViewer>
</Grid>
不隶属于 StackOverflow