Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvRichEditor
How to add color & font style formatted text

Adding color & font style formatted text to TAdvRichEditor can be done with setting a selection and calling AdvRichEditor.SetSelectionColor() or AdvRichEditor.SetSelectionBold(), etc.. but it can also be done by changing the AdvRichEditor.Font before adding new text.

Sample code:

begin
  AdvRichEditor1.Font.Style := [fsBold];
  AdvRichEditor1.Font.Color := clBlue;
  AdvRichEditor1.AddText('Hello world,');
  AdvRichEditor1.Font.Style := [fsItalic];
  AdvRichEditor1.Font.Color := clRed;
  AdvRichEditor1.AddText('this text is in red italic');
end;