BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Richedit - change colors without selecting (Selstart, SelLen

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using
View previous topic :: View next topic  
Author Message
Ralf
Guest





PostPosted: Wed Nov 26, 2003 10:54 am    Post subject: Richedit - change colors without selecting (Selstart, SelLen Reply with quote



Is there an elegant way of changing the color of sections of the Text in
RichEdit *without* selecting the text and then changing SelAttributes? Since
I want to be able to highlight various parts of a paragraph, I find the
flickering caused by the Caret and the inverted selections rather ugly.

I found a rather crude approach by doing a:
Text :=
'{rtf1ansiansicpg1252deff0deflang1031{fonttbl{f0fswissfcharset0
Arial;}}{colortbl ;red255green0blue0;}Hallo cf1 Americacf0 !';

but apparently this also includes Fonts and Charactersets, which I would
rather not touch...

Again thanks for any suggestions!

Ralf


Back to top
Iain Macmillan
Guest





PostPosted: Thu Nov 27, 2003 12:19 am    Post subject: Re: Richedit - change colors without selecting (Selstart,Sel Reply with quote



In article <3fc48681 (AT) newsgroups (DOT) borland.com>, "Ralf" <ralf@?tmx.de?> wrote:


Quote:
Is there an elegant way of changing the color of sections of the Text in
RichEdit *without* selecting the text and then changing SelAttributes?
Not easily.


Quote:
Since
I want to be able to highlight various parts of a paragraph, I find the
flickering caused by the Caret and the inverted selections rather ugly.
Have you tried doing the modifications inside a BeginUpdate/EndUpdate?



Quote:
I found a rather crude approach by doing a:
Text :=
'{rtf1ansiansicpg1252deff0deflang1031{fonttbl{f0fswissfcharset0
Arial;}}{colortbl ;red255green0blue0;}Hallo cf1 Americacf0 !';

but apparently this also includes Fonts and Charactersets, which I would
rather not touch...
If you really want to do this, you could stream the rtf out, parse the

contents of the stream looking for the colour definition you want and change
the rgb values before streaming it back in.. as I say, not easily <g>.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Using All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.