How to write text in the same line but with different color? (I use richedit).
procedure TForm1.btnEClick(sender: TObject);
begin
m0.SelAttributes.Color := clBlue;
m0.SelAttributes.Style := [fsBold];
m0.lines.add('This is blue and it is bold');
m0.SelAttributes.Color := clGreen;
m0.SelAttributes.Style := [fsBold];
m0.lines.add ('This is Green and it is bold');
m0.lines.add('');
m0.lines.add('But how to write text in the same line with different color?');
// i want to have both blue and green in the same line
end;
Best Wishes, Bee
Length(RichEdit1.Lines.Text)
toRichEdit1.GetTextLen()
, no need to waste memory retrieving the actualText
as astring
just to get its length, when theTRichEdit
already knows that info internally. – Arnoldoarnon