OwnerDraw property


Available for Button, List, Combo and TabStrip objects.

Read/Write at design time

Specifies whether the contents of a List or Combo object, or the appearance of a Button or TabStrip object, has to be drawn by the operating system or by the application which owns it. For List and Combo objects it can be one of the following values:

0  None  The operating system draws the contents of the list box (default)
1  Fixed  The contents of the list box has to be drawn by the application and items are the same height
2  Variable  The contents of the list box has to be drawn by the application and items are variable in height


For Button and TabStrip objects it can be one of the following values:

FALSE   The operating system draws the control (default)
TRUE     Easy Code or the application have to draw the control.



REMARKS: When the OwnerDraw property is Fixed o Variable for List and Combo objects, or TRUE for Button and TabStrip objects, the application receives a WM_DRAWITEM message each time the object must be redrawn. As usual in Easy Code, the message is received by the owner window even though the control to be drawn is a child of a Group, Picture or Rebar object.


Button objects

If the OwnerDraw property is set to FALSE (default value), the operating system draws the corresponding button. If so, you must take into account that Windows XP and later may vary the appearance for buttons depending on the new "Common controls" (see the Enabling XP themes topic). On the other hand, if this property is set to TRUE, the application will receive the WM_DRAWITEM message. There you can draw a custom button or just letting Easy Code to do so (recommended). If the application draws the button, the return value for this message must be TRUE, so that Easy Code do not process it again. On the contrary, if the return value is FALSE (default), Easy Code will draw the button with its corresponding image (bitmap, icon or cursor) and text.


List and Combo objects


If the OwnerDraw property is set to Fixed or Variable, the operating system does not draw the list box contents. Instead, you will have to process the WM_DRAWITEM message in order to draw the contents. The return value for this message must be TRUE


TabStrip objects

When the OwnerDraw property is set to FALSE (default value), the operating system draws the tab control. If so, you must take into account that Windows XP and later may vary the appearance for tab controls depending on the new "Common controls" (see the Enabling XP themes topic). On the other hand, if this property is set to TRUE, the application will receive a WM_DRAWITEM message each time the tab control needs to be painted.


IMPORTANT:
In order to take advantage of the new look for buttons and other controls in Windows XP and later, the new Common controls 6.0 have to be enabled. For more information, see the Enabling XP themes topic.


REMARKS:
BackColor, ForeColor, Picture and PicturePosition properties only take effect for Button objects if the OwnerDraw property is set to TRUE.