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.
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:
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.
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.
Supplementing automation support, the Visual Studio SDK provides the following interfaces to provide VSPackages greater control over how the Toolbox is managed.
Allows applications to manage, add, and remove ToolboxItem objects from the Toolbox. Also enables configuration of appearance and Toolbox categories.
Allows applications to manage, add, and remove Active-based Toolbox controls, as well as configure Toolbox categories and appearance.
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:
IToolboxService is available only to Managed Package Framework-based VSPackages.
ActiveX controls cannot be directly added to the Toolbox using IToolboxService.
Visual Studio provides the Aximp.exe tool for automating the wrapping of an ActiveX control in a control derived from AxHost. For more information, see Windows Forms ActiveX Control Importer (Aximp.exe).
Objects only obtain an instance of IVsToolbox2.
Objects needing functionality in both interfaces must obtain instances of both interfaces from the environment.
When using IToolboxService, it is up to the implementer to manage localized information, such as names of categories.
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.