views:

55

answers:

2

Hello,

How can I build on C# a a list like on Messenger where contacts appear with an image and a text with the contact's name? What components should I use to build it? Using Winforms by the way.

Thanks

+1  A: 

Look at the ListView control. It provides you with the ability to have a list of items and also bind a ImageList which provides icons for each entry.

http://ondotnet.com/pub/a/dotnet/2002/10/28/listview.html

+1  A: 

A ListView is the right choice here. Drop an ImageList on the form as well, that stores the images. Set the ListView's View property to Tile and its TileSize to the size of the tiles you want. For each item you add to the list view, set its Text property to the label you want to show to the right of the image. And the ImageIndex property to the index of the image in the ImageList. You can try this all out in the designer without writing code.

Hans Passant
How can I put the image on the left and the text on the right and/or bellow?
zeze
Have you tried it? That's what setting the list view's View property to Tile does by default. The ListViewItem.Text property is shown to the right of the image. Using the default, View = LargeIcon, shows the Text property at the bottom of the image.
Hans Passant