Displaying a small icon in a ListViewItem's text (.NET 3.5)

presidentender

Golden Member
Jan 23, 2008
1,166
0
76
We have a ListView control which displays thumbnails and filenames from images and videos. The problem is that there's no good visual cue that distinguishes between the images and the videos; you get a ton of thumbnails, and the extensions are there, but don't "pop out enough."

Things we've tried which have been unsatisfactory:
Highlighting or changing the text or background color of videos (makes them look selected, is confusing).

Changing the text of the ListViewItems to just "Image" or "Video" (still doesn't "pop out enough").

Bolding the text under a video's thumbnail (unclear).

The solution we decided on at yesterday's meeting was to put a small icon (Webdings character 0xB7) in the text of the ListViewItem. The problem with this is that there doesn't seem to be a way to use two fonts for any control's text.

To resolve this, my first thought was to treat the text as a label, since labels support displaying images, and use a bitmap of the Webding character followed by the text. That would work if the text was a label, but it's not.

Right now, I'm at the point of either writing a custom control, or setting the ListView's OwnerDraw as "true" and making changes to the drawing myself, manually drawing the Webding where it needs to be and offsetting the text appropriately. The problem with this approach is that it seems fragile and easy to do wrong (earlier in the design, the PM specifically said we don't want to play with painting the control).

So, experienced .NET developers, how would you do this? Unless I'm missing something, these are mutually exclusive requirements. Not cool.

Cliffs
I need a good way to display a visual cue to distinguish between thumbnails of images and thumbnails of videos in a single ListView control. The visual cue must "pop" and be noticeable, but must not confuse the user. None of my solutions so far are satisfactory.

 

imported_Dhaval00

Senior member
Jul 23, 2004
573
0
0
Have you looked at the SmallImageList property? Essentially, you create a repository of images (go with BMPs - PNGs will stretch out) using an ImageList control. Then, point the ListView.SmallImageList property to this ImageList. There is also a LargeImageList, if I remember correctly.

Edit: Since you're on .NET 3.5, why not use the newer, more layout-friendly WPF controls? You can host a WPF control within your form, too. Just an afterthought...
 

presidentender

Golden Member
Jan 23, 2008
1,166
0
76
Originally posted by: Dhaval00
Have you looked at the SmallImageList property? Essentially, you create a repository of images (go with BMPs - PNGs will stretch out) using an ImageList control. Then, point the ListView.SmallImageList property to this ImageList. There is also a LargeImageList, if I remember correctly.

Edit: Since you're on .NET 3.5, why not use the newer, more layout-friendly WPF controls? You can host a WPF control within your form, too. Just an afterthought...

The SmallImageList and LargeImageList properties control the images displayed in the ListView. Which is displayed depends on the View property, which can be set similarly to a Windows folder's view options (thumbnails (corresponding to large icons), icons(corresponding to small icons), list, details, or tiles). Thus, I could use a different image list, but I'd still be displaying thumbnails (and the thumbnails aren't distinguishable at a glance).

Originally posted by: brandonbull
Can you change the cursor based on the different file type?

That's a good idea, and we hadn't talked about it, but it doesn't give us the "at-a-glance" distinction between images and videos.

*sigh* guess it's OwnerDraw for me.... Thanks, guys.
 

presidentender

Golden Member
Jan 23, 2008
1,166
0
76
So, I mentioned hosting a WPF control within our Windows Form, and that spiraled out to reworking the whole application in WPF. Now I get to be our WPF expert :)
 
Oct 27, 2007
17,009
5
0
LOL good for you. I'd highly recommend reading up on the Model-View-ViewModel design pattern if you're working in WPF. It might take a while to get your head around it but WPF applications really shouldn't be written as though they were WinForms with a fancy GUI.