Solved

Set more colors in one line in RichEdit

Posted on 2001-06-30
6
212 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

864 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

25 Experts available now in Live!

Get 1:1 Help Now