Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

When you add the "img" variable to the Items collection, you are actually adding the

image itself to the collection, but the ListBox can only display strings. By default, it

uses the ToString() method of any object in the collection to display on the list. This

is where the "System.Drawing.Bitmap" comes from.

 

To remedy your problem, you'll need to keep track of a separate collection (something

like an ArrayList) to store the actual pictures in. When you add items to the ListBox,

instead of adding the Image itself, just add the file name, and add the Image

to your separate collection.

 

Make sure that when you add and remove file names from the listbox that you

do the same to the image collection, so that the item indices of both collections

match up.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

You need a listview and an imagelist. put your thumbnails in the imagelist. set the listview's "normal imagelist" property to your imagelist. the listview's view property must be set to 0 - lvwicon.

when you add an item to your listview you can give it a name, that will be shown under your thumbnail and a number (the number of the picture in your imagelist).

Posted

You have to change the size in the ImageList. I never tested it in .net but in vb6 you had to change image size before adding the first image to the ImageList. In .net there's a property ImageList.ImageSize. I don't know if this is what you look for, but it looks good.

 

Tell me if it works,

max

  • *Experts*
Posted

Make sure the Height and Width of the ImageSize don't exceed 256; anything larger

throws an ArgumentException.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

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