![]() |
|
#1
|
||||
|
||||
RichEdit DemoGID Forums C/C++ Forums
Name/Brief Description: RichEdit Demo - MFC Date of Original Submission: May 26, 2004 Submitted by: MaxPayne License: None. Brief Description: This a demo program showing how to use Rich Edit Control in a MFC application. The following is a list of features and MFC methods that is used in the program. They shows some basic and advanced methods of programming MFC. 1. MFC controls usage, Extended ComboBox and Normal ComboBox, Check Box, Radio Button and Rich Edit. 2. Shows how to change a static control to a rich edit control using subclassing technique. 3. Creating a SDI application and using a FormView. 4. How to update controls in a formview as usually done with controls toolbar. 5. How to use the CRichEditCtrl class and its member functions to make text formating in the control. Detail : This project is a SDI application which uses the FormView as its view object.The CFormView class is the base class used for form views. A form view act like dialog and you can place controls in it as you would with a dialog. There are 5 different controls used in the project and all of them is placed in the FormView. Lets go one by one of this controls: Normal ComboBox : This controls is used in the project to store font size. and the base class is CComboBox, which has the funtionality of a list box and also a edit control. Extended ComboBox : This control is used to display all the fonts installed in the user's system. The CComboBoxEx class is the base class for Extended ComboBox and it extends the combo box control by providing support for image lists.It can be used to access images in the Image List.CImageList is the base class that provides support for image list. CPP / C++ / C Code:
Check Box: The check box used here is the three button ('B','I' and 'U') which properties is set to 'pushlike' so it looks like a button but behaves like a check box. The check box used to set the text formating effects to Bold,Italic and Undeline. Radio Button: This control also used to look like buttons but behave like a radio button. This buuton are used in the project to set paragraph alignment 'L' for left Align, 'C' for center and 'R' for right align. Rich Edit: Actually, the control used is a Static control, and it was subclassed to the base class CRichEditCtrl to behave and acts like a rich edit control. The CMyRichEditCtrl is the new class created to derive from CRichEditCtrl base class. The static controls ID is used to subclass it to the Rich Edit. CPP / C++ / C Code:
As the rich Edit control is created, its ready for use. __________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#2
|
||||
|
||||
|
Here is the projects zip file:
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#3
|
|||
|
|||
Lots of bugs in the downloaded codeI have downloaded this code and found that it has at least three bugs.
1) The pointer m_ctlRichEdit is uninitialized on first use. It should be initialized to 0 in the constructor and then tested for zero in (at least) OnSize. 2) The number of fonts is hard coded to 1000. My XP SP2 system has more than 1000 fonts by default. This oversight causes a subscript out of range condition. 3) Once those two bugs are cleared we still get an addressing exception. I'll let the author fix that one. |
|
#4
|
||||
|
||||
|
I just want to say thanks for your remarks on Max Payne's code submittal.
Unfortunatelly, Max hasn't been active on this forum for a while - so he might not have any idea about your (very good) observations. I am actually surprised he didn't see these problems in this program - I guess it worked fine on his machine and he didn't bother to check it through. Thanks again and welcome to the GID Forums! Kind regards, Luci __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
Recent GIDBlog
Stupid Management Policies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ultra-fast hosting with free setup and a Real 24/7 Support, $5/Mo, Control Panel Demo | hostorange | Web Hosting Advertisements & Offers | 0 | 23-May-2003 08:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The