Solved

Set more colors in one line in RichEdit

Posted on 2001-06-30
6
221 Views
Last Modified: 2013-11-22
I am using RichEdit's SelAtribute funtion to change font colors. Can anyone tell me how to set more than one color in a single line?
ysimon
0
Comment
Question by:ysimon
[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
  • 4
6 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6242051
? whats the problem

may have this line in richedit

This is a line

use a code like

richedit1.selstart := 0;
richedit1.sellength := 4;
richedit1.selattributes.color := clred;
richedit1.selstart := 10;
richedit1.sellength := 4;
richedit1.selattributes.color := clblue;

now you will have 'This' in red and 'line' in blue the rest remains in the default color usual black

(that was just from head, syntax errors possible)

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6242063
as working sample (tested)

procedure TForm1.Button1Click(Sender: TObject);
begin
  richedit1.lines.clear;
  richedit1.lines.add('This is a line');
  richedit1.selstart := 0;
  richedit1.sellength := 4;
  richedit1.selattributes.color := clred;
  richedit1.selstart := 10;
  richedit1.sellength := 4;
  richedit1.selattributes.color := clblue;
  richedit1.SelStart := 0;
  richedit1.Sellength := 0;
end;

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6247433
hello? anyone here?
0
Industry Leaders: 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 1

Expert Comment

by:drnadeem
ID: 6247653
listening
0
 

Author Comment

by:ysimon
ID: 6249469
Thank you kretzschmar,
It works.
ysimon
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 6251396
well, then may i lock this q ;-)

don't forget the grading

glad to helped you
good luck again

meikl ;-)
0

Featured Post

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!

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 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