RAD Studio
ContentsIndex
PreviousUpNext
Indicating That a Control Is Owner-drawn

To customize the drawing of a control, you must supply event handlers that render the control's image when it needs to be painted. Some controls receive these events automatically. For example, list views, tree views, and toolbars all receive events at various stages in the drawing process without your having to set any properties. These events have names such as OnCustomDraw or OnAdvancedCustomDraw

Other controls, however, require you to set a property before they receive owner-draw events. List boxes, combo boxes, header controls, and status bars have a property called Style. Style determines whether the control uses the default drawing (called the "standard" style) or owner drawing. Grids use a property called DefaultDrawing to enable or disable the default drawing. List views and tab controls have a property called OwnerDraw that enables or disabled the default drawing. 

List boxes and combo boxes have additional owner-draw styles, called fixed and variable, as the following table describes. Other controls are always fixed, although the size of the item that contains the text may vary, the size of each item is determined before drawing the control.  

Fixed vs. variable owner-draw styles  

Owner-draw style 
Meaning 
Examples 
Fixed  
Each item is the same height, with that height determined by the ItemHeight property.  
lbOwnerDrawFixed,csOwnerDrawFixed  
Variable  
Each item might have a different height, determined by the data at runtime.  
lbOwnerDrawVariable, csOwnerDrawVariable  
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!