次の方法で共有


DialogPage Class

Provides a standard dialog box 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 by using the Visual Studio settings mechanism.

This API is not CLS-compliant. 

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

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
<ComVisibleAttribute(True)> _
Public Class DialogPage _
    Inherits Component _
    Implements IWin32Window, IProfileManager
'Usage
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 you create a user dialog box, especially 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 the following:

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

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

    • Applications that must access the automation object of the class use the AutomationObject property.

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

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

  • Support for the Visual Studio settings mechanism, based on the public properties of the automation object of the derived class.

  • A default user interface that is based on the public properties of the automation object of the derived class.

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

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

    • Dialog pages use Window to return a IWin32Window, which provides a handle to the window that provides the user interface of the class.

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

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

    • Changes to public properties made through the user interface of a dialog page 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.

Note

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

Reference

DialogPage Members

Microsoft.VisualStudio.Shell Namespace

IProfileManager

Component

PropertyGrid

IDispatch

IWin32Window

Other Resources

Extending the Automation Model

Options Pages

Toolbox (Visual Studio SDK)

State Persistence and the Visual Studio IDE

Extending the Visual Studio Environment