I need to make more room between each list item. Is it possible to change Listview item height in Delphi?
The Delphi TListView
control is a wrapper around the Microsoft control. It descends from TCustomMultiSelectListControl
. While the TListView
does not expose an ItemHeight
property, the TCustomMultiSelectListControl is also the ancestor for the TListBox
, which does expose this property.
The TListBox's ItemHeight property is implemented in TCustomListBox (which descends from TCustomMultiSelectListControl). Although the property is not in the common ancestor, wading through MSDN seems to indicate that the standard listview and listbox controls share many messages, amongst which the LB_SETITEMHEIGHT
. Unfortunately, that message is nowhere to be found in the VCL.
From what I can gather from a cursory glance at the implementation of SetItemHeight in TCustomListBox and the use of (F)ItemHeight in that class, you would need to:
All in all not a simple exercise. If you your app permits it and you can switch to a TListBox
or a TColumnListBox
, your task will become a lot easier...
Update
Seeing Ken's answer. Of course using the ImageList to change the ItemHeight is vsList mode is a much easier approach!
What mode is your TListView
in? (There are 4, and things change for different modes - that's why there are different modes in the first place.)
Since you're asking about height, I'm guessing you're in vsList
mode. In this case, the height of each row is determined by the height of the SmallImages
Imagelist
. You can change the row height by assigning taller images to that ImageList
.