![]() ![]() | ||
As mentioned several times in this book, space is usually at a premium in Windows programs, and the tab control is another one that (like menus, combo boxes, drop-down list boxes, etc.) is designed to help you conserve space. Tab controls work much like the tabs in a set of folders in a filing cabinet; you can click a tab to display a whole new client area, and each such client area can display other controls. You can see a tab control at work in Figure 10.7, which is the TabControls example on the CD-ROM. In this case, the first tab displays a page that holds buttons, the next tab's page displays a rich text box, and the third tab's page displays a picture box. Using tabs like this allows you to present page after page of controls, all in the same space. Tabs like these are becoming increasingly popular in dialog boxes that let the user select options. If you've got 2,000 options from which the user may select (as many Microsoft applications seem to have), you can divide them up by category and give each category its own tab page.
The central property of the TabControl is TabPages, which contains the individual tab pages in the control, each of which is a TabPage object. When a tab is clicked, it displays its page and causes a Click event for that TabPage object. You can add new tab pages with the TabPages collection's Add method, and remove them with the Remove method.
Now it's time to get all the details on these controls in the Immediate Solutions section.
![]() ![]() | ||