Changing Text Color in CRichEditCtrl
WaiWai -- lamwai@iscs.nus.sg
Thursday, October 17, 1996
Environment: VC 4.0, Win95
I am writing a syntax highlighting editor. i have encountered this
problem when the user trys to join 2 valid words together, i can't reset
the color of te woird.
e.g
int i; //where int is in blue and i is in black
becomes=>
inti; //now, inti should be in black color
however, by using SelSelectionCharFormat, it seems that the funtion is not
able to change the text color (bcoz of multi-color text selection???)
so i have to set the word to black by character by character, which is
very slow. :( can someone show the way to change the text color in 1
shoot?
thanx :)
wai
MHENRY.UMI.COM -- MHENRY@umi.com
Friday, October 18, 1996
I can't see why you're having problems, but it's hard to tell with no code.
You can change a multi-colored selection to one color just fine
CHARFORMAT newcf;
newcf.dwMask = CFM_COLOR;
newcf.dwEffects = 0;
newcf.crTextColor = RGB(blah,blah,blah);
GetRichEditCtrl()->SetSel(iBlah1, iBlah2);
GetRichEditCtrl()->SetSelectionCharFormat(newcf);
You must be forgetting something in your CHARFORMAT.
--matt
/~~~~~~~~~~~~~~~~~~~~~~~~~~~
Matthew Henry -- UMI
mhenry@umi.com (Work)
mhenry1384@aol.com (Home)
~~~~~~~~~~~~~~~~~~~~~~~~~~/
Environment: VC 4.0, Win95
I am writing a syntax highlighting editor. i have encountered this
problem when the user trys to join 2 valid words together, i can't reset
the color of te woird.
e.g
int i; //where int is in blue and i is in black
becomes=>
inti; //now, inti should be in black color
however, by using SelSelectionCharFormat, it seems that the funtion is not
able to change the text color (bcoz of multi-color text selection???)
so i have to set the word to black by character by character, which is
very slow. :( can someone show the way to change the text color in 1
shoot?
thanx :)
wai
| Вернуться в корень Архива
|