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 开发者_如何学JAVAmultiple 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?
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.
A ListView cannot do such a thing. Well... it can, but only with ObjectListView and even then it's not easy. There is a sample showing how to do something like that, but not quite:
(source: sourceforge.net)
Try using Lee Paul Alexander’s fantastic Outlook-style list.
精彩评论