Gewusst wie: Erstellen benutzerdefinierter Optionsseiten im Menü "Extras"

Aktualisiert: November 2007

The Options dialog box on the Tools menu displays a variety of option pages for different parts of Visual Studio. You can control the existing options pages, as outlined in Steuern der Einstellungen im Dialogfeld "Optionen" (Menü "Extras"), and you can also create your own custom pages. You can use custom pages to allow users to change settings for your add-ins or other programs.

Creating your own custom Tools Options pages is easier than ever before. You no longer need to use an add-in to create a new Tools Options page because the page definitions are now stored in separate XML files rather than in registry keys. Consequently, you can now create Tools Options pages that are accessible in the Macros integrated development environment (IDE) as well as the main Visual Studio IDE.

The following procedure demonstrates how to create a custom user control that will act as a custom Tools Options page, and then modify a .Addin file to reference it.

Hinweis:

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. These procedures were developed with the General Development Settings active. To change your settings, choose Import and ExportSettings on the Tools menu. For more information, see Visual Studio-Einstellungen.

To create a custom Tools Options page

  1. Create a new Windows Control Library project. Name it ToolsOptionsLibrary.dll.

  2. Add the controls and functionality you desire to the user control.

    This user control will become the custom Tools Option page. You should resize the control to fill the Tools Options dialog box client area.

  3. Build the project.

    Visual Studio looks for all shared .Addin files when it starts and loads those that are present. The Tools Options page named Add-in/Macros Security defines a set of tokens for file paths for .Addin files. The following tokens are included:

    • %ALLUSERSPROFILE%

    • %APPDATA%

    • %USERPROFILE%

    • %VSAPPDATA%

    • %VSCOMMONAPPDATA%

    When Visual Studio begins searching for .Addin files, it replaces these tokens with the following path strings:

Token

Path

%ALLUSERSPROFILE%

<drive>:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\Addins

%APPDATA%

<drive>:\Documents and Settings\<username>\Microsoft\MSEnvShared\Addins

%USERPROFILE%

<drive>:\Documents and Settings\<username>\My Documents\Visual Studio 2005\Addins

%VSAPPDATA%

<drive>:\Documents and Settings\<username>\Addins

%VSCOMMONAPPDATA%

<drive>:\Documents and Settings\All Users\Addins

For more information about registering add-ins, see Add-In-Sicherheit.

In addition to this example, you can download a full-featured Tools Option page from the Visual Studio Automation Samples Web site. See the RegExplore sample on the Automation Samples site. This example, however, shows how to create a Tools Options page using a COM control.

Siehe auch

Aufgaben

Gewusst wie: Ändern des Erscheinungsbilds eines Fensters

Konzepte

Steuern der Einstellungen im Dialogfeld "Optionen" (Menü "Extras")

Add-In-Registrierung

Diagramm "Automationsobjektmodell"

Weitere Ressourcen

Erstellen und Steuern von Umgebungsfenstern

Referenz zur Automatisierung und Erweiterbarkeit