ListView OwnerDraw height of items
I have a listview with OwnerDraw = true and Details view mode. I want when the list contains 3,4 or 5 items the height of each item to be listview.Height/3 ,4 or 5 without scrolling.
I know that the height of item depends on size of the font.
This doesn't work
listView.Font = new Font("Arial", listView.Height / nOfItems);
I draw the text at DrawItem event with constant font size: e.Graphics.DrawString(....).
What I do successfully is to adjust the height of the list view by assigning an image list with a dummy image with the appropriate height I want to have.
So e.g. to have rows with each 40 pixel high, I assign an image with 40 pixel height to the list view inside an image list.
You do not have to actually draw the image, it is sufficient to assign it and do owner drawing then. It looks like e.g. the list in the background of this screenshot (it is a CMS I wrote in .NET).
you r right.
actually when you change the ImageSize property in ImageList, i have seen the ImageList goes empty. so for your problem You have to refill the ImageList with desire ImageSize again. try it it could solve your problem.