The information in this article applies to:
SUMMARY
Owner-draw controls are a new feature of Windows version 3.0. Because your
application does all the drawing of the contents of the controls, you can
customize them any way you like. Owner-draw controls are similar to
predefined controls in that Windows will handle the control's functionality
and mouse and keyboard input processing. However, you are responsible for
drawing the owner-draw control in its normal, selected, and focus states.
MORE INFORMATION
The Windows SDK sample application MENU demonstrates owner-draw menu items.
The SDK sample application OWNCOMBO is a fairly large example of owner-draw
and predefined list boxes and combo boxes.
Q64326 : Owner-Draw: Handling WM_DRAWITEM for Drawing ControlsTo respond to a WM_MEASUREITEM message, you MUST specify the height of the appropriate item in your control. Optionally, you can specify the item's width as well. If you want to do something special when a string is deleted from a list box, you should process WM_DELETEITEM messages. Windows's default action is to erase the deleted string and to redraw the list box. If you want to have control over the sorting for the order of items in a list box or combo box that does not have the *_HASSTRINGS style, you should specify the appropriate *_SORT style and process WM_COMPAREITEM messages. If the *_SORT and *_HASSTRINGS styles are present, Windows will automatically do the sorting without sending WM_COMPAREITEM messages. If *_SORT is not specified, WM_COMPAREITEM messages will not be generated and items will be displayed in the list box in the order in which they were inserted. The heart of owner-draw controls is the response to WM_DRAWITEM messages. During this processing is when you draw an entire button or each individual item in a menu, list box, or combo box. Because Windows does not interfere in the drawing of owner-draw controls, your application must draw the specified control item. The display of the control must indicate the state of the control. Common states are as follows:
Under Windows 95, the BS_BITMAP style allows buttons to display bitmaps without using owner-draw. Additional query words: owndraw od owner draw win16sdk
Keywords : kbCtrl kbNTOS kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS |
Last Reviewed: February 1, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |