Adding Graphics to Controls
Go Up to Working with Controls Index
Several controls let you customize the way the control is rendered. These include list boxes, combo boxes, menus, headers, tab controls, list views, status bars, tree views, and toolbars. Instead of using the standard method of drawing a control or its items, the control's owner (generally, the form) draws them at run time. The most common use for owner-draw controls is to provide graphics instead of, or in addition to, text for items. For information on using owner-draw to add images to menus, see Adding Images to Menu Items.
All owner-draw controls contain lists of items. Usually, those lists are lists of strings that are displayed as text, or lists of objects that contain strings that are displayed as text. You can associate an object with each item in the list to make it easy to use that object when drawing items.
In general, creating an owner-draw control involves these steps:
- Indicating that a control is owner-drawn.
- Adding graphical objects to a string list.
- Drawing owner-drawn items.
- Indicating That a Control Is Owner-drawn
- Adding Graphical Objects to a String List
- Sizing Owner-draw Items
- Drawing Owner-draw Items