Click here to Skip to main content
11,647,659 members (64,804 online)
Click here to Skip to main content

Using RichEdit control in the MFC Grid Control

, 4 Jan 2004 60.2K 4.1K 32
Rate this:
Please Sign up or sign in to vote.
Explains how to use RichEdit Control to edit cells in the MFC Grid Control

Introduction

I was looking for code to add extra features to the MFC Grid Control so that the user can format the cells like 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 in order to implement this new cell type into a MFC Grid control:

  • CInPlaceRichEdit derived from CRichEditCtrl. This class allows the user to edit the contents of a cell and change the text attributes (bold, italic, underline).
  • CGridCellRich derived from CGridCell. This class draw the formatted text in the cell, and add the extra formatting features.

Using the new cell is simple. For example, you can call CGridCtrl::SetDefaultCellTypelike 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

Thanks to Chris Maunder for his great MFC Grid Control.

History

  • 01/03/2004 : first release.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author


You may also be interested in...

Comments and Discussions

 
QuestionHow to read RTF file to the grid? Pin
dqf8826-Apr-10 19:16
memberdqf8826-Apr-10 19:16 
Questionchange textcolor of selected line Pin
smini25-Feb-10 3:16
membersmini25-Feb-10 3:16 
Questioncan display only one line. Pin
hujunxi7-Jul-08 8:05
memberhujunxi7-Jul-08 8:05 
GeneralAutosize row height if fontsize changed or VK_RETRURN in a cell Pin
brazilien14-Feb-08 21:35
memberbrazilien14-Feb-08 21:35 
Questionhow to rmove hint box Pin
fatalfeel22-Apr-07 4:33
memberfatalfeel22-Apr-07 4:33 
AnswerRe: how to rmove hint box Pin
hitxinyu23-May-07 17:12
memberhitxinyu23-May-07 17:12 
Questionhow to print this richedit text Pin
Kashif Bashir30-Sep-06 0:16
memberKashif Bashir30-Sep-06 0:16 
GeneralMore Theorytically Description Pin
austin.rock95-Sep-06 0:43
memberaustin.rock95-Sep-06 0:43 
Generalabout titletips Pin
kickme@sina.com8-Jul-04 17:11
memberkickme@sina.com8-Jul-04 17:11 
GeneralLooks exciting Pin
NGS 5496725-Jan-04 5:54
memberNGS 5496725-Jan-04 5:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150804.3 | Last Updated 5 Jan 2004
Article Copyright 2004 by Atlence
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid