Udostępnij za pośrednictwem


How to: Host An Editor in Another Editor

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

In Visual Studio you can host one editor inside another by specifying the hosting window as a parent window. To do so, set the parameters __VSFPROPID2 and __VSFPROPID2 on the child window frame.

To set up the window frame to host an editor

  1. Designate an editor as a hosted editor by creating a child window pane.

    This pane is where the editor's text will go.

  2. Create the hosting editor using the OpenStandardEditor or OpenSpecificEditor method.

  3. Set the __VSFPROPID2 and __VSFPROPID2 properties in the window frame implementation of the hosted editor by passing these properties as the parameters to the SetProperty method, respectively.

    If you need to retrieve these parameters, pass these properties to the GetProperty method.

  4. Call the Show method for the contained editor.

    The editor appears in the hosted pane of the containing editor.

Robust Programming

The Application Designer in the Visual Studio Team Edition for Architects is an example of an editor window frame hosting another editor. The Application Designer hosts other designers in its right-hand pane. A designer panel (or Properties page) for each of the contained designers is added to the containing window frame.