listview subitems / images ? is it possible?

dynamic_sysop

Senior Contributor
Joined
Oct 1, 2002
Messages
1,039
Location
Ashby, Leicestershire.
hi , has anyone got a way of adding images to a listview subitem? over the months i've grown to like vb.net over vb6 in many ways, but i think that the listview seems a retrograde step:-\ , when i make an irc client in vb6 i can add an unconverted nickname to the main list ( leaving the "." or "@" for a host or owner as this keeps them at the top of the list ) then i add the converted name ( minus the "." or "@" ) with the corisponding icon for a host or owner next to it [ this is added as a subitem ]
i set the first list to 0 wide so it's hidden and then fullrow select to On. this allows me to show hosts etc kept at the top without all the messy dots and @ signs.....

now vb.net arrrrrrrrrrrgh, it wont allow me to add images to the subitems, so i'm stuck with the dot's and @ signs ( unless i set the first row to 17 wide to show an icon and then the second row as the main row ( but this looks messy because of the gap between the icons and text )
is there any way at all to add the icons or if it's not possible to hide the first char ( eg: the "." or "@" ) from view in the first row?
any help would be appreciated ty.:)
 
I thin you would need to either owner draw your listview, or look around for someone else who already did it. I've seen a few owner drawn listviews out there, but most of them are just mocked up to work like a datagrid.
 
Am I missing something? I don't remember VB6 listviews being able to show icons in subitems either.

ListViews in .NET can have custom sorters associated with them to compare two values, as I recall. Take a peek at the ListViewItemSorter property.
 
i know we dont show vb6 code on here but just to show how straightforwards it is / was in vb6 to add subitem icons...
Code:
If Len(SName) > 1 Then
    Set strItem = frmClient.lvwYou.ListItems.Add(, SName, SName & " " & UnConverted, , ReturnIcon)'// this is the normal icon
    strItem.ListSubItems.Add , , strNick, ProfIcon'// this is the subitem icon
    ProfIcon = 0
End If
you can set the first column to 0 width so it doesnt show , then you only see the subitem row
eg:
row 1 --------------- row2
(icon) @Dynamic (icon) Dynamic
with ^^ set to 0 it'd show as this...
row2
(icon) Dynamic
and stay sorted according to row1:)
 
Back
Top