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

Comments
How can you use this class in a DOC/VIEW
Posted by Legacy on 08/20/2003 12:00amOriginally posted by: Tom Hill
Hi
I Already Use in Doc/View by do following:
I Creat my project with name CTestRichView which inherit from CviewEditCtrl you should see in step 6 of MFC widzard
Then int function CTestRichViewView::OnInitialUpdate()
you should insert:
CRichEditCtrl &theRich=this->GetRichEditCtrl();
CRTFBuilder b ;
b << size ( 35 )
<< bold(true)
<< color( 1 )
<< "The Title\n"
<< write( theRich ) ;
ReplyYou remember include RichEditCtrlEx.h and Link file Lib
Hope you success
googbye
Nice RichText Programming!
Posted by Legacy on 04/23/2003 12:00amOriginally posted by: Laser Park
Reply[Re] VC6 errors
Posted by Legacy on 03/07/2003 12:00amOriginally posted by: Young Su, Cha
try to do like this;
for(iterator i=begin(); i!=end(); i++)
-> for(const_iterator i = begin( ) ; i!=end( ) ; i++)
..
Replycompiler error in VC6
Posted by Legacy on 09/21/2002 12:00amOriginally posted by: tjie
Replyneed to extract bold text alone in rtf control in vb
Posted by Legacy on 01/24/2002 12:00amOriginally posted by: vikram
ReplyHow to make it work with Unicode
Posted by Legacy on 12/14/2001 12:00amOriginally posted by: Hope
This is a great project. But if I change project setting to have _UNICODE and recompiled, nothing was put out to the two edit window.
Please help to get it work with Unicode.
Thanks a million!!
Hope
ReplyHelp about CRichEditCtrl in Windows 2000
Posted by Legacy on 11/09/2001 12:00amOriginally posted by: Ignacio Garcia
In my application, i use a CRitchEditCtrl to show a text. I change the char type between Arial to Symbol, and i do it with the method SetSelectionCharFormat. But Windows 2000 don't change the char type because don't untherstand this method. I would like to know what can i do, if i have to use a library, or header file or if i need a compiler more actual. Thank you and sorry because my English is very bad.
Replyneed help: dealing with mouse in a richeditctrl
Posted by Legacy on 07/04/2001 12:00amOriginally posted by: sabine
I need some help in dealing with this richeditctrl.
Replyi want to get any message or make any change when I click on the richeditctrl.
I need some more help on the "CRichEditDtrl::FindText" function. I always get (-1) as its return value, eventhough the text i'm looking for is shown in the richeditctrl.
I will be so greatful if anyone could help!
Need Help about Win Sockets
Posted by Legacy on 12/18/2000 12:00amOriginally posted by: Junaid
i m developing urdu chat server for Lan's
Replyanybody to help in sockets
Column (Block) Marking by Alt + Left-Mouse-Down-Drag
Posted by Legacy on 05/23/2000 12:00amOriginally posted by: basava
Hello,
We need to implement this column marking in a rich-edit-ctrl. This feature is available in many editors - Msdev, MsWord etc. You can select a vertical block by dragging left-Mouse-down with Alt key pressed. You can cut, copy, delete or paste the column-marked selection. It is very useful feature in any edit control.
Can anyone tell me how to enable this feature for rich-edit-control or how can it be implemented?
Thanks
ReplyBasava.
Loading, Please Wait ...