Solved

Text Color in TMEMO or other component

Posted on 2000-03-16
7
317 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
7 Comments
 
LVL 2

Accepted Solution

by:
aubs earned 100 total points
Comment Utility
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
Comment Utility
aubs is right, your need require a rich edit component.
0
 
LVL 7

Expert Comment

by:RBertora
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 7

Expert Comment

by:RBertora
Comment Utility
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
Comment Utility
Whay don't use TMemoColor ?
I use it and is very nice .
Regards,
Nick aka ginsonic
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
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
Comment Utility
Thank aubs and I accept  your comment as answer. Thank you all for your comment :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now