Owner-Drawn Push Buttons

When you use the BS_OWNERDRAW style for a button, you assume all responsibility for drawing the button. You cannot use any other button styles with the BS_OWNERDRAW style. When you use an owner-drawn button, you have to trap the WM_DRAWITEM message in the window procedure for the button's parent window, and you must insert the code that erases the background, if necessary, and draws the button.

The WM_DRAWITEM message is not generated by the window manager; it is part of the interface between a button and its owner. When you use a built-in button class, the button's window procedure automatically sends the WM_DRAWITEM message to the button's parent window when the button receives a WM_PAINT message. If you create a new class of button — a button that is not a built-in button — and you want it to support the WM_DRAWITEM message, you must send the WM_DRAWITEM message to the button's parent window whenever the button needs to be redrawn.

Note Windows CE does not support the BS_BITMAP, BS_FLAT, BS_ICON, BS_PUSHBOX, BS_TEXT, or BS_USERBUTTON styles. Use the BS_OWNERDRAW style to create the effects you would otherwise achieve by using the BS_BITMAP, BS_ICON, or BS_USERBUTTON button styles.