Compartir a través de


DialogPage Class

Provides a standard dialog functionality for implementing Toolbox property sheets, ToolsOptions pages, or custom UI dialog boxes with support for the Visual Studio automation model, Windows Forms, and state persistence through the Visual Studio settings mechanism.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)

Syntax

<CLSCompliantAttribute(False)> _
<ComVisibleAttribute(True)> _
Public Class DialogPage _
    Inherits Component _
    Implements IWin32Window, IProfileManager

Dim instance As DialogPage
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public class DialogPage : Component, IWin32Window, 
    IProfileManager
[CLSCompliantAttribute(false)]
[ComVisibleAttribute(true)]
public ref class DialogPage : public Component, 
    IWin32Window, IProfileManager
public class DialogPage extends Component implements IWin32Window, IProfileManager

Remarks

Notes for Implementers

Implement classes derived from DialogPage when creating a user dialog box, particularly either a Tools Options page or a Toolbox property page.

Notes for Callers

The simplest implementation of DialogPage requires only the definition of public properties on the implementing class. The property types must support conversion to and from strings through TypeConverter.

The base implementation of DialogPage provides default handlers for standard windows events, and implements the Component, IWin32Window, and IProfileManager.

Classes derived from DialogPage have:

  1. Automatic support for component sharing through the Visual Studio DTE automation object model.

    • Any instance of DialogPage is an automation object, as the class inherits the Component interface's implementation.

    • Applications needing to access the class's automation object use the AutomationObject property.

      The AutomationObject property returns this (Me in Visual Basic), since the implementation of DialogPage is already an automation object by default.

    • An implementation of DialogPage can offer an automation object other then itself by overriding the base AutomationObject implementation.. This might be done, for example, to provide separate user interface and the object models.

  2. Support for the Visual Studio settings mechanism based on the public properties of the derived classes automation object.

  3. A default user interface based on the public properties of the derived class's automation object.

    • For a dialog page implementation to provide a Tools Options page it must be registered using ProvideOptionPageAttribute.

    • For a dialog page implementation to provide a Toolbox dialog page it must be registered using ProvideToolboxPageAttribute.

    • Dialog pages use Window to return a IWin32Window which provides a handle to the window providing the class's user interface.

    • By default the window referenced by Window is a property grid, implemented by an instance of PropertyGrid selecting the automation object.

    • The DialogPage base class uses its implementation of AutomationObject to obtain the class's automation object and the public properties of that automation object.

    • Changes to public properties made through a dialog page's user interface are automatically saved to local storage (typically the registry) by a call to the SaveSettingsToStorage method.

    • A dialog page implementation can change its user interface by overriding Window.

Nota

Typically an instance of a dialog page class is its own automation object. Therefore, properties persisted or displayed are those of the class derived from DialogPage. However, if AutomationObject returns another object, it is that object's properties, not the class's, which are persisted or displayed.

Inheritance Hierarchy

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      Microsoft.VisualStudio.Shell.DialogPage

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Concepts

Extending the Automation Model

Tools Options Pages

Toolbox (Visual Studio SDK)

State Persistence and the Visual Studio IDE

Extending the Visual Studio Environment

Reference

DialogPage Members

Microsoft.VisualStudio.Shell Namespace

IProfileManager

Component

PropertyGrid

IDispatch

IWin32Window