共用方式為


Simplified Embedding

Simplified embedding is enabled in an editor when its document view object is parented to (that is, made a child of) Visual Studio, and the IVsWindowPane interface is implemented to handle its window commands. Simplified embedding editors cannot host active controls. The objects used to create an editor with simplified embedding are shown in the following illustration.

Editor with simplified embedding

Simplified Embedding Editor graphic

注意

Of the objects in this illustration, only the CYourEditorFactory object is required to create a standard file-based editor. If you are creating a custom editor, you are not required to implement IVsPersistDocData2, because your editor will likely have its own private persistence mechanism. For non-custom editors, however, you must do so.

All interfaces implemented to create an editor with simplified embedding are contained in the CYourEditorDocument object. However, to support multiple views of document data, split the interfaces onto separate data and view objects as indicated in the following table.

Interface

Location of interface

Use

IVsWindowPane

View

Provides connection to the parent window.

IOleCommandTarget

View

Handles commands.

IVsStatusbarUser

View

Enables status bar updates.

IVsToolboxUser

View

Enables Toolbox items.

IVsFileChangeEvents

Data

Sends notifications when the file changes.

IPersistFileFormat

Data

Enables the Save As feature for a file type.

IVsPersistDocData2

Data

Enables persistence for the document.

IVsDocDataFileChangeControl

Data

Allows suppression of file change events, such as reload triggering.