Advanced RichEditCtrl

There are two main classes
CRTFBuilder responsible for all RTF building
CRichEditCtrlEx, which simply derives from CRichEditCtrl and adds a few methods


RTFBuilder starts off with 1 font and 4 colors:

Arial,
Black,
Red,
Green
Blue


Methods:

black, red, blue, green turns text to the specified color
color Takes a COLORREF and turns the text that color
font Changes the font. Takes a font name as a string
size Takes an integer as the font size
bold(bool) Turns text bold
italic(bool) italic
underline(bool) underline
strike(bool) strike through
normal turns off the above 4 settings
push pushes the current settings on it's own stack
pull pulls the last settings from the stack
write Takes a CRichEditCtrl as a parameter and writes to that control. Can also use the '>>' operator (see example)

RichEditCtrlEx simply derives fron CRichEditCtrl and adds a few methods
enable(bool)
disable(bool)

It also overrides PreSubclassWindow to turn the background color to that of the dialog(button) color to give the appearance of a simple lable and sets the control to read only.

The export declarations in the 'RichEd' header make it possible to compile RichEditCtrlEx.cpp in either a library of MFC extension DLL.

The 'RichEd' project is the library and the 'test' project is an example dialog based exe project.
To get going, simply compile and run.

Download demo project/source - 21 KB

Date Posted: 08.08.98