Board index » delphi » Rich Edit Font Color Change in Code

Rich Edit Font Color Change in Code

Hi......2 questions

At design time I want to insert text into a RichEdit control.

1- How do I change the color of a specific line in a rich edit?
eg:

RichEdit1.Lines.Add('This is GREEN text');
RichEdit1.Lines[1].Font.Color := clGreen; <<<<<<<

RichEdit1.Lines.Add('This is RED text');
RichEdit1.Lines[2].Font.Color := clred; <<<<<<<

----------
2- How do I change the color of a single word in a line of text?

--
many thanks

heidi
Please remove STOPSPAM from my e-mail address

---------------------------------------------------------------------
   Choose Cruelty Free - not tested on animals
http://www.onthenet.com.au/~tropix/Welcome.html
         Free guide to cruelty free shopping
---------------------------------------------------------------------

 

Re:Rich Edit Font Color Change in Code


RichEdit1.SelAttributes.Color:=clRed;
RichEdit1.Lines.Add('This will be red');
RichEdit1.SelAttributes.Color:=clBlue;
RichEdit1.Lines.Add('This will be blue');

You can figure out yourself how to do it for specific words...

Gilles Baatsen

Quote
heidi wrote in message <72fpmv$u...@corolla.OntheNet.com.au>...
>Hi......2 questions

>At design time I want to insert text into a RichEdit control.

>1- How do I change the color of a specific line in a rich edit?

Other Threads