How to make a single line bold in a RichEdit?
Asked Answered
G

1

5

How can I get one specific line to be bold in a RichEdit?

Gian answered 21/1, 2016 at 17:41 Comment(1)
Set SelAttributes and write a new line. Or, select an already existing line and set SelAttributes.Franek
O
7

Formatting in a rich edit control is done like this:

  1. Select the text to which formatting is to be applied.
  2. Apply that formatting to the selection.

It goes something like this:

RichEdit1.SelStart := SelectionStart;
RichEdit1.SelLength := SelectionLength;
RichEdit1.SelAttributes.Style := RichEdit1.SelAttributes.Style + [fsBold];

Of course, you have to work out what to use in place of SelectionStart and SelectionLength. Ultimately that comes down to how you are managing the text and I don't think there's enough information in the question to give you a single definitive answer on that topic.

Overtax answered 21/1, 2016 at 17:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.