I want to change the Item's/Row's height in listview.
I searched every where and I figured that in order to change the height I need to use LBS_OWNERDRAWFIXED
or MeasureItem
or something like that.
The problem is that I dont know exactly what to do and how to use it..
Can anyone help me with it?
Edit:
I cant use the ImageList hack because I am using the SmallImageList for real and I need different line height from the ImageList images size.
Thanks!
It can be done using the SmallImageList
trick -- you just have to be careful. ObjectListView -- an open source wrapper around a standard .NET ListView
-- uses that trick to successfully implement a RowHeight
property.
If you want 32 pixels for each row, allocate an ImageList
that is 16x32 (width x height), and then position each of your images in the vertical middle of the 32-pixel height.
This screen shot shows 32-pixel rows and the word wrapping that is possible because of the extra space:
ObjectListView
does all this work for you. In fact, if you are trying to do anything with a ListView, you should seriously looked at using an ObjectListView
instead. It makes many difficult things (e.g. sorting by column type, custom tooltips) trivial, and several impossible things (e.g. overlays, groups on virtual lists) possible.