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


Managing the Toolbox

The Visual Studio SDK allows a VSPackage, such as an editor or designer, to manage the membership and appearance of the Toolbox.

In addition, The Toolbox itself can be managed using automation. For more information on managing a Toolbox through automation, see How to: Control the Toolbox.

Automatic Toolbox Tab Selection

A particular Toolbox tab or category can be automatically made active based on which editor or designer is currently active. For example, if a forms designer is activated, you may want the All Windows Forms tab selected.

This support is limited to editors and designers requiring:

  1. The implementation of a factory object to provide instances of the editor or designer. For more information on implementing a designer or editor factory object, see Editor Factories.

  2. Registration of the toolbox tab that automatically is activated if the editor or designer is present. For more information about registering automatic toolbox tab selection, see Registering Toolbox Support Features.

Controlling the Toolbox

Supplementing automation support, the Visual Studio SDK provides the following interfaces to provide VSPackages greater control over how the Toolbox is managed.

Interface

Description

IToolboxService

Allows applications to manage, add, and remove ToolboxItem objects from the Toolbox. Also enables configuration of appearance and Toolbox categories.

IVsToolbox2

Allows applications to manage, add, and remove Active-based Toolbox controls, as well as configure Toolbox categories and appearance.

IVsToolbox3

Extends functionality found in IVsToolbox2 by providing complete support for persistence and localization.

There are several important points to keep in mind when working with these interfaces:

Use the settings mechanism to enable users to save Toolbox settings accessed by users from the Import/Export Settings command, found on the IDE's Tools menu. For more information on how to use settings, see State Persistence and the Visual Studio IDE.

See Also

Reference

IVsToolbox2

IVsToolbox3

IVsToolboxActiveUserHook

IVsToolboxClipboardCycler

IVsToolboxUser

Other Resources

State Persistence and the Visual Studio IDE

Toolbox (Visual Studio SDK)