Partager via


Visual Basic Concepts

Creating Property Pages for ActiveX Controls

Property pages offer an alternative to the Properties window for viewing ActiveX control properties. You can group several related properties on a page, or use a page to provide a dialog-like interface for a property that's too complex for the Properties window.

In Visual Basic, property pages are displayed in the Property Pages tabbed dialog box, as shown in Figure 10.1.

Figure 10.1   The Properties window and the Property Pages dialog box

Each tab in the Property Pages dialog box represents one PropertyPage object. For example, the PropertyPage object that provides the General tab shown in Figure 10.1 was created using the PropertyPage designer shown in Figure 10.2.

Figure 10.2   The PropertyPage designer for the General tab

In the designer, the PropertyPage object doesn’t display a tab. Nor does it display the OK, Cancel, and Apply buttons. These are provided automatically by the Property Pages dialog, and are not part of any individual PropertyPage object. The Property Pages dialog uses the Caption property of the PropertyPage object as the text for the tab.

In this example, the General page groups two properties, DinoName and Age. The page is laid out to simplify localization; the length of the captions can change without affecting the layout. This is discussed in "Property Page Design Guidelines."

The following topics explain how property pages work, and the different ways you can use them in your ActiveX controls.

Topics

How Property Pages Work

Property pages look a lot like forms, but they have very different behavior. This topic explains the events you need to handle.

Connecting a Property Page to an ActiveX Control

Once you’ve added a property page to your project, you need to connect it to any control that’s going to use it.

Associating a Property Page with a Property

Explains how to designate a property page to be opened when the user edits a property in the Properties window.

Using Standard Property Pages

Visual Basic provides standard pages for fonts, colors, and pictures.

Property Page Design Guidelines

Some guidelines to help you create easy-to-use, professional-looking property pages.

For More Information   A simple property page example can be found in the step by step procedures in "Creating an ActiveX Control." Control creation is covered in depth in "Building ActiveX Controls." The Property Page Wizard can automate much of the work of creating property pages. Search for Property Page Wizard.