RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomListBox.MeasureItem Method

Generates an OnMeasureItem event.

Pascal
procedure MeasureItem(Index: Integer; var Height: Integer); virtual;
C++
virtual __fastcall MeasureItem(int Index, int Height);

MeasureItem is called whenever a visual aspect of a variable owner-draw list box changes and the value of the Style property is csOwnerDrawVariable.  

Before drawing its items, a variable owner-draw list box calls MeasureItem once for each visible item, passing the index of the item to measure, and the default height of the item. Since Height is passed by reference (a var parameter), MeasureItem can increase or reduce the height of each item as needed. 

By default, the MeasureItem method does nothing except call any event handler attached to the OnMeasureItem event. Override MeasureItem to change or add functionality to the default behavior. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!