Search code examples
listviewwinformsownerdrawn

Windows Forms ListView in Details Mode - How to Change Row Height in Owner Draw?


I've got a Windows Forms ListView control in details mode. There are multiple columns at play. I'm trying to use owner draw to place a particularly wide column "below" the others.

So, instead of this:

COLUMN1  COLUMN2  COLUMN3  COLUMNNNNNNNNNNNNNNNNNNN4

I'm trying to do this:

COLUMN1  COLUMN2  COLUMN3
COLUMNNNNNNNNNNNNNNNNNNN4

I cannot figure out how to enlarge the bounds of the item to fit in the room to draw the column below. Any ideas?


Solution

  • All rows in a ListView have to be the same height. You can get a tall row that fits more than one line of text by making the Font large, then using a small font in the DrawItem event handler.

    If this is too restrictive then you should look at DataGridView or a custom 3rd party component.