Rich Edit Coloring
-
I have a string formatted as such: "The last word is \ggreen" I want to place this text in a Rich Edit Control, replacing '\g' with the change of color to green. At the moment I'm thinking of making a loop to cycle through the string placing each letter in one at a time and changing the default color when \g is encountered. This seems grossly inefficient, is there a better way to do it (Escape codes ala DOS??) - X
-
I have a string formatted as such: "The last word is \ggreen" I want to place this text in a Rich Edit Control, replacing '\g' with the change of color to green. At the moment I'm thinking of making a loop to cycle through the string placing each letter in one at a time and changing the default color when \g is encountered. This seems grossly inefficient, is there a better way to do it (Escape codes ala DOS??) - X
I'm not sure how much better a solution this would be but here goes, you could try searching for the '\g' and place everything previous to it into the control, then change the colour and then place the rest of the text. I think this would be more efficient because it would then only require the rich edit control to call your EditStreamCallback function twice in the case of your sample string (as opposed to the 20 odd calls it that would be required if you did it character by character). Just a thought... Ben Burnett "It's all absolutely devastatingly true -- except the bits that are lies" - Douglas Adams