15.5. Creating Owner-Drawn List Controls
How to create owner-drawn controls is a frequent topic of discussion forums and newsgroups. In this section we will discuss how an owner-drawn process works for Windows controls and how you can create your own controls.
15.5.1. The DrawItem Event
The DrawItem event is raised by owner-drawn controls. This event passes an argument of type DrawItemEventArgs, which contains data related to the event. The user uses this data to paint a specific item of the control. The properties of the DrawItemEventArgs class are given in Table 15.1.
Besides the properties listed in Table 15.1, the DrawItemEventArgs class provides two useful methods: DrawBackground and DrawFocusRectangle. The DrawBackground method draws ...