Processing the WM_DRAWITEM Message
An owner-drawn combo box sends the
WM_DRAWITEM message to its parent window or dialog box procedure each time the
application must repaint a list item. The
lParam parameter points to a
DRAWITEMSTRUCT structure that identifies the control and list item. It also contains
information needed to paint the item.
The example in
Creating a Square Meal Dialog Box displays the list-item text and the bitmap associated with the food group. If
the item has the focus, it also draws a focus rectangle. Before displaying the
text, the example sets the foreground and background colors, based on the item
selected. Because the combo box has the CBS_HASSTRINGS style, the combo box
maintains the text for each list item that can be retrieved using the
CB_GETLBTEXT message.
The bitmaps used for the list item depend on the food group. InitGroupList
uses the
CB_SETITEMDATA message to associate a constant with each list item, identifying the
corresponding food group. The window procedure uses this value, contained in the
itemData member of the
DRAWITEMSTRUCT structure, to determine which bitmaps to display. The system uses two bitmaps
for each food group symbol: a monochrome bitmap with the SRCAND raster
operation to erase the irregular region behind the image, and a color bitmap with the
SRCPAINT raster operation to paint the image.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database