Chapter 4. Custom Controls

When the user clicks on the All Customers button of the Welcome page you've been building in previous chapters, a Rolodex of all the customers is displayed, as shown in Figure 4-1.

Complete Customer Rolodex

Figure 4-1. Complete Customer Rolodex

Unfortunately, Microsoft neglected to include a Rolodex control in Visual Studio 2005. No problem, though; in this chapter, you'll implement your own as a custom control.

Tip

This code builds on the project started in the previous chapter. You can download the source code completed in Chapter 3 if you would like to start here.

Custom Controls

Custom controls come in three flavors:

A derived control

With a derived control, you take an existing control (e.g., a button) and give it new capabilities. For example, you might create a button that knows how many times it has been clicked.

A composite control

In a composite control, you take existing controls (whether provided by the Framework, or ones you've created) and you package them together into a single control.

A from-scratch control

Creating a custom control from scratch requires that you draw the control yourself using the GDI+ capabilities covered in the next chapter.

Get Programming Visual Basic 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.