次の方法で共有


Creating Tools Options Pages with Managed Package Framework Classes

In the Visual Studio managed package framework, classes derived from DialogPage extend the Visual Studio IDE by adding Options pages under the Tools menu.

An object implementing a given Tools Option page is associated with specific VSPackages by the ProvideOptionPageAttribute object.

Because the environment instantiates the object implementing a particular Tools Options page when that particular page is displayed by the IDE:

  • A Tools Option page should be implemented on its own object, and not on the object implementing a VSPackage.

  • An object cannot implement multiple Tools Options pages.

Registering as a Tools Options Page Provider

A VSPackage supporting user configuration through Tools Options pages indicates the objects providing these Tools Options pages by applying instances of ProvideOptionPageAttribute applied to the Package implementation.

There must be one instance of ProvideOptionPageAttribute for every DialogPage-derived type that implements a Tools Options page.

Each instance of ProvideOptionPageAttribute uses the type that implements the Tools Options page, strings that contain the category and sub-category used to identify a Tools Options page, and resource information to register the type as providing a Tools Options page. For more information, see Using Tools Options Pages.

Persisting Tools Options Page State

If a Tools Options page implementation is registered with automation support enabled, the IDE persists the page's state along with all other Tools Options pages. For more information, see Using Tools Options Pages.

A VSPackage can manage its own persistence by using ProvideProfileAttribute. Only one or the other method of persistence should be used.

Implementing DialogPage Class

An object providing a VSPackage's implementation of a DialogPage-derived type can take advantage of the following inherited features:

The minimum requirement for an object implementing a Tools Options page using DialogPage is the addition of public properties.

If the class properly registered as a Tools Options page provider, then its public properties are available on the Options section of the Tools menu in the form of a property grid.

All these default features can be overridden. For example, to create a more sophisticated user interface requires only overriding the default implementation of Window.

See Also

Concepts

User Settings and Options

Automation Support for Tools Options Pages

Registering Custom Tools Options Pages

Using Tools Options Pages

Creating Tools Options Pages with Automation

Creating Tools Options Pages with Interop Assemblies

Tools Options Pages