Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted

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.:)

  • 3 weeks later...
Guest Deleted member 22320
Posted
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.
  • *Gurus*
Posted

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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

  • Leaders
Posted

i know we dont show vb6 code on here but just to show how straightforwards it is / was in vb6 to add subitem icons...

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:)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...