June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to create a list box that includes pictures, formatted text, or colored item backgrounds.
Set the list box DrawMode to OwnerDrawVariable, and handle the MeasureItem and DrawItem events.
By implementing an owner-drawn list box, you can draw custom content in a list box item in the same way that you would draw graphics in a Paint event handler. The only challenge is deciding where to store item-specific graphics or formatting information.
To create a basic owner-drawn list box, set the ListBox.DrawMode property to OwnerDrawVariable (or you can use OwnerDrawFixed if you know that every list item will have the same height). This signals that you want to write the drawing logic for the control. ...
Read now
Unlock full access