Creating a tabbed dialog box

Tabbed dialog boxes are useful because they let you present information in small, organized chunks. The Excel Options dialog box (which is displayed when you choose ToolsOOptions) is a good example. This dialog box uses a whopping 13 tabs to add some organization to an overwhelming number of options.

Creating your own tabbed dialog boxes is relatively easy, thanks to the MultiPage control. Figure 18-11 shows a custom dialog box that uses a MultiPage control with three pages, or tabs. When the user clicks a tab, a new page is activated and only the controls on that page are displayed.

Keep the following points in mind when using the MultiPage control to create a tabbed dialog box:

1 Use only one MultiPage control per dialog box.

1 Make sure to use the MultiPage control, not the TabStrip control. The TabStrip control is more difficult to use.

i Make some controls (such as OK and Cancel buttons) visible at all times. Place these controls outside the MultiPage control.

i Right-click a tab on the MultiPage control to display a shortcut menu that lets you add, remove, rename, or move a tab.

i At design time, click a tab to activate the page. After it is activated, add other controls to the page using normal procedures.

i To select the MultiPage control itself (rather than a page on the control), click the border of the MultiPage control. Keep your eye on the Properties window, which displays the name and type of the selected control. You can also select the MultiPage control by selecting its name from the dropdown list in the Properties window.

i You can change the look of the MultiPage control by changing the Style and TabOrientation properties.

i The Value property of a MultiPage control determines which page is displayed. For example, if you write code to set the Value property to 0, the first page of the MultiPage control is displayed.

This example is available at this book's Web site.

Figure 18-11:

This dialog box uses a MultiPage control.

Figure 18-11:

This dialog box uses a MultiPage control.

Was this article helpful?

0 0

Post a comment