Thursday, April 1, 2010

Easiest way to set ListView ItemHeight in an Owner-Drawn ListView

When creating an owner-drawn ListBox, you will receive measure-item messages that allow you to specify the height of items.  In a ListView control, that functionality is not there.  So how is the ItemHeight determined in a ListView in Details mode?  It uses the ImageList height then the Font height, so to override the item height create a dummy ImageList and set it to the desired height and assign it to the listview depending on the view.  Using the Font to set the height does not work very well because it also affects the height of the Header control, an unwanted side-effect.

No comments: