Поделиться через


Simplified Embedding

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Simplified Embedding Editor graphic
Editor with simplified embedding

Note

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.