gpt4 book ai didi

wpf - WPF:如何证明段落中的所有行(还有换行符的行)

转载 作者:行者123 更新时间:2023-12-02 04:16:08 25 4
gpt4 key购买 nike

我在FlowDocument中有一些段落,我需要证明所有行的合理性(即使是带有换行符的行)

这是一个代码示例:

 <Paragraph TextAlignment="Justify">
"One of the most important operations necessary when text materials
are prepared for printing or display is the task of dividing long
paragraphs into individual lines.<LineBreak/>
When this job has been done well,
people will not be aware of the fact that the words they are reading
have been broken apart arbitrarily and placed into a somewhat rigid
and unnatural rectangular framework; but if the job has been done
poorly, readers will be distracted by bad breaks that interrupt
their train of thought."
</Paragraph>

上面的输出不会证明有换行的行,该行将向左对齐,我需要的是所有行的宽度相同的行

如何做到这一点?

(请注意,如果段落中有换行符并设置为合理,则所需的输出与以ms字为单位的输出相同,例如,如果一行中有3个字,则左侧有1个字,中间有1个字右边的一个)

谢谢,
山姆

最佳答案

我认为您无法实现自己想要的。即使您将<LineBreak/>替换为一个封闭的段落(我知道您也不想这么做):

<Paragraph TextAlignment="Justify">
One of the most important operations necessary when text materials
are prepared for printing or display is the task of dividing long
paragraphs into individual lines.
</Paragraph>
<Paragraph TextAlignment="Justify">
When this job has been done well,
people will not be aware of the fact that the words they are reading
have been broken apart arbitrarily and placed into a somewhat rigid
and unnatural rectangular framework; but if the job has been done
poorly, readers will be distracted by bad breaks that interrupt
their train of thought.
</Paragraph>

该段的最后一行左对齐。

关于wpf - WPF:如何证明段落中的所有行(还有换行符的行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2724650/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com