Link to home
Start Free TrialLog in
Avatar of cristh
cristh

asked on

Text Color in TMEMO or other component

How to set each word in TMEMO to many color font in one line ? I can set  to one color only. How do I  or have any component that I can use more ?
ASKER CERTIFIED SOLUTION
Avatar of aubs
aubs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
aubs is right, your need require a rich edit component.
Avatar of RBertora
If you are using D4 or less then this is the code using a TRichedit component as suggested earlier:

    RichEditMemo.Selstart := Length(RichEditMemo.Text);
    RichEditMemo.SelAttributes.Color := clBlue;
    RichEditMemo.SelText := 'This is the first line in blue'+#10;
    RichEditMemo.Selstart := Length(RichEditMemo.Text);
    RichEditMemo.SelAttributes.Color := clBlack;
    RichEditMemo.SelText := 'This is the second line in black'+#10;

Rob;-)
If you are using D4 or less then this is the code using a TRichedit component as suggested earlier:

    RichEditMemo.Selstart := Length(RichEditMemo.Text);
    RichEditMemo.SelAttributes.Color := clBlue;
    RichEditMemo.SelText := 'This is the first line in blue'+#10;
    RichEditMemo.Selstart := Length(RichEditMemo.Text);
    RichEditMemo.SelAttributes.Color := clBlack;
    RichEditMemo.SelText := 'This is the second line in black'+#10;

Rob;-)
Whay don't use TMemoColor ?
I use it and is very nice .
Regards,
Nick aka ginsonic
This is the download address :
http://www.balticsolutions.com/
It's freeware .
Pay only if you wish the source code .

Nick
Avatar of cristh
cristh

ASKER

Thank aubs and I accept  your comment as answer. Thank you all for your comment :)