Environment: VC6, Win9x, NT4, W2K, MFC
I was looking for a code to add extra features to the MFC Grid Control so that the user can format the cells as in a spreadsheet program. So, I've created a demo project that shows how to replace the default editing with a Rich Edit Control.
Using the Code
Two new classes are added to implement this new cell type into a MFC Grid control:
CInPlaceRichEdit, derived from
CRichEditCtrl. This class allows the user to edit the content of a cell and change the text attributes (bold, italic, underline).
CGridCellRich, derived from
CGridCell. This class draws the formatted text in the cell, and adds the extra formatting features.
Using the new cell is simple. For example, you can call CGridCtrl::SetDefaultCellType like this:
m_Grid.SetCellType (row,col, RUNTIME_CLASS(CGridCellRich));
For more information on how to use a owner cell type, read the Chris Maunder article here.
Thanks to Chris Maunder for his great MFC Grid Control.
01/03/2004: first release.
DownloadsDownload demo project - 47 Kb
Download source - 102 Kb