Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Called by the framework when a visual aspect of an owner-drawn checklist box changes.

virtual void DrawItem(



A long pointer to a DRAWITEMSTRUCT structure that contains information about the type of drawing required.

The itemAction and itemState members of the DRAWITEMSTRUCT structure define the drawing action that is to be performed.

By default, this function draws a default checkbox list, consisting of a list of strings each with a default-sized checkbox to the left. The checkbox list size is the one specified in Create.

Override this member function to implement drawing of owner-draw checklist boxes that are not the default, such as checklist boxes with lists that aren't strings, with variable-height items, or with checkboxes that aren't on the left. The application should restore all graphics device interface (GDI) objects selected for the display context supplied in lpDrawItemStruct before the termination of this member function.

If checklist box items are not all the same height, the checklist box style (specified in Create) must be LBS_OWNERVARIABLE, and you must override the MeasureItem function.

© 2015 Microsoft