 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ralf Guest
|
Posted: Wed Nov 26, 2003 10:54 am Post subject: Richedit - change colors without selecting (Selstart, SelLen |
|
|
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
|
Posted: Thu Nov 27, 2003 12:19 am Post subject: Re: Richedit - change colors without selecting (Selstart,Sel |
|
|
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 |
|
 |
|
|
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
|
|