Solved

Text Color in TMEMO or other component

Posted on 2000-03-16
7
323 Views
Last Modified: 2010-04-04
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 ?
0
Comment
Question by:cristh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Accepted Solution

by:
aubs earned 100 total points
ID: 2624052
Use a richedit on the win32 tab.

Look in the online help how to set the font color and style, use the SelAttributes  property.

This is taken from the online help:

This example requires a TRichEdit and two TButtons. Leave the default text, usually "RichEdit1", in the lines property. The DefAttributes will apply to this text.

procedure TForm1.Button1Click(Sender: TObject);
begin
  with RichEdit1.SelAttributes do
  begin
    Color := clRed;
    Height := Height + 5;
  end;
  RichEdit1.Lines.Add('This line of text will be red.');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  RichEdit1.DefAttributes.Color := clBlue;
  RichEdit1.DefAttributes.Style := [fsBold, fsItalic];
end;

0
 
LVL 3

Expert Comment

by:markshiffer
ID: 2624270
aubs is right, your need require a rich edit component.
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2624346
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;-)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:RBertora
ID: 2624347
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;-)
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 2626973
Whay don't use TMemoColor ?
I use it and is very nice .
Regards,
Nick aka ginsonic
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 2627034
This is the download address :
http://www.balticsolutions.com/
It's freeware .
Pay only if you wish the source code .

Nick
0
 

Author Comment

by:cristh
ID: 2630451
Thank aubs and I accept  your comment as answer. Thank you all for your comment :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SUM 2 INTEGER ARRAYS INTO 1 10 116
Need Help Delphi 2010 CheckBox1 Stored value in memo 13 98
CheckListBox usage 3 96
Delphi and Access based Enumeration 9 87
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question