在 tRichEdit 中管理段落选项卡设置 - Delphi

Managing paragraph Tab settings in a tRichEdit - Delphi

我正在使用 tRichEdit 组件并使用 tSpinedit 来确定制表符间距,使用 trichedit.oncreate 事件生成制表符位置数组作为开始。这工作正常,我生成的每个新段落都使用定义的制表符间距。但是,当使用 SpinEdit1 Change 事件时,我可以更改光标所在文本段落的制表符间距,但它不会在整个 richedit 文本中执行。

有没有办法在 richedit 文档的所有段落中应用新的制表位设置?

当我使用 tForm1.SpinEdit1Change 更改选项卡设置时,当前段落和后续段落的选项卡会更改,但之前的段落保持原样。有没有办法遍历 richedit1 内容中的段落以在 'for' 循环中更改所有段落?我没有在属性中找到任何数组或列表。是否有 属性 用于在运行时全局设置选项卡或可以实现此目的的其他方法?

Select 设置制表符位置之前的所有段落(从文档的开头到结尾)。您可以手动 select 所有段落,或使用

以编程方式
RichEdit1.SelectAll;

参考。文档: Vcl.ComCtrls.TCustomRichEdit.Paragraph

Paragraph formatting information includes alignment, indentation, numbering, and tabs.

Paragraph is a read-only property, because a TCustomRichEdit object has only one TParaAttributes object, which cannot be changed. The attributes of the current paragraphs, however, can be changed, by setting the properties of the TParaAttributes object.

The current paragraphs are the paragraphs that contain the selected text. If no text is selected, the current paragraph is the one containing the cursor.