Rich Edit 控件中的格式设置如下所示:
事情是这样的:
RichEdit1.SelStart := SelectionStart;
RichEdit1.SelLength := SelectionLength;
RichEdit1.SelAttributes.Style := RichEdit1.SelAttributes.Style + [fsBold];
Run Code Online (Sandbox Code Playgroud)
当然,您必须弄清楚用什么来代替SelectionStart
和SelectionLength
。最终,这取决于您如何管理文本,我认为问题中没有足够的信息来为您提供有关该主题的单一明确答案。