共用方式為


CRichEditCntrItem Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CRichEditCntrItem Class.

With CRichEditView and CRichEditDoc, provides the functionality of the rich edit control within the context of MFC's document view architecture.

Syntax

class CRichEditCntrItem : public COleClientItem  

Members

Public Constructors

Name Description
CRichEditCntrItem::CRichEditCntrItem Constructs a CRichEditCntrItem object.

Public Methods

Name Description
CRichEditCntrItem::SyncToRichEditObject Activates the item as another type.

Remarks

A "rich edit control" is a window in which the user can enter and edit text. The text can be assigned character and paragraph formatting, and can include embedded OLE objects. Rich edit controls provide a programming interface for formatting text. However, an application must implement any user interface components necessary to make formatting operations available to the user.

CRichEditView maintains the text and formatting characteristic of text. CRichEditDoc maintains the list of OLE client items which are in the view. CRichEditCntrItem provides container-side access to the OLE client item.

This Windows Common control (and therefore the CRichEditCtrl and related classes) is available only to programs running under Windows 95/98 and Windows NT versions 3.51 and later.

For an example of using rich edit container items in an MFC application, see the WORDPAD sample application.

Inheritance Hierarchy

CObject

CCmdTarget

CDocItem

COleClientItem

CRichEditCntrItem

Requirements

Header: afxrich.h

CRichEditCntrItem::CRichEditCntrItem

Call this function to create a CRichEditCntrItem object and add it to the container document.

CRichEditCntrItem(
    REOBJECT* preo = NULL,  
    CRichEditDoc* pContainer = NULL);

Parameters

preo
Pointer to an REOBJECT structure which describes an OLE item. The new CRichEditCntrItem object is constructed around this OLE item. If preo is NULL, the client item is empty.

pContainer
Pointer to the container document that will contain this item. If pContainer is NULL, you must explicitly call COleDocument::AddItem to add this client item to a document.

Remarks

This function does not perform any OLE initialization.

For more information, see the REOBJECT structure in the Windows SDK.

CRichEditCntrItem::SyncToRichEditObject

Call this function to synchronize the device aspect, DVASPECT, of this CRichEditCntrltem to that specified by reo.

void SyncToRichEditObject(REOBJECT& reo);

Parameters

reo
Reference to an REOBJECT structure which describes an OLE item.

Remarks

For more information, see DVASPECT in the Windows SDK.

See Also

MFC Sample WORDPAD
COleClientItem Class
Hierarchy Chart
CRichEditDoc Class
CRichEditView Class