Colored Text w/ Edit Boxes (MSVC++)
Posted on 1998-01-19
Currently in my windows program I need to "color" certain
letters in a read-only edit box I have in my dialog
based application. So far, I've just been creating
objects of type CFont the same font as the dialog box,
figuring out the height/width of the font, and calling the GetDC function of the edit box, then over-writing the
appropriate text in the edit box with portions of the text
in different colors.
As one could imagine this can be very tedious and its
hard to get everything lined up correctly! The CEdit class
has a function for returning the topmost line which
is being viewed, so I can find that and make the changes
in my painting function, however CEdit has no function
for returning the horizontal scroll position. And Horizontally, Edit boxes can be scrolled by pixel, not by column, and lining text up would be very tricky anyway.
Soo, my question is, Is there any public domain class or
existic mfc class that I can use to just display text and
scroll through it just like CEdit does, and be able to
specify RGB values for characters/lines of text?? I DON'T
need the user to be able to input in such an object.
Thanks in advance..