albert
albert

Reputation: 1571

Listview image on columns

I have a listview (details view) and I display a column of images and a column of text, It's possible to display the image in the second column (without OwnerDraw)? I want to put the text in the first because only the first column can be edited by the user (LabelEdit property)

ListViewItem lvi = new ListViewItem("");
lvi.ImageKey = "image";      // column 1
lvi.SubItems.Add("subitem 2"); // column 2

Thank You

UPDATE

Native listview supports images in subitems (LVS_EX_SUBITEMIMAGES) since before win 98 but they didn't include it in .NET. http://msdn.microsoft.com/en-us/library/windows/desktop/bb774732(v=vs.85).aspx

A codeproject example http://www.codeproject.com/Articles/7630/ListView-with-Image-on-SubItems

Upvotes: 0

Views: 1587

Answers (1)

Tobia Zambon
Tobia Zambon

Reputation: 7629

No, without OwnerDraw it is not possible.

In your case the simplest thing is to manage the editing of other columns instead of manage the OwnerDraw. There are some example of how to do it:

example 1 example 2 example 3

ecc...

Upvotes: 1

Related Questions