469,927 Members | 1,806 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

how to add Image array / ImageList.ImageCollection to a control?

Hi,

I'm creating a customized picturebox that will have an array of images
and some properties that will allow the picturebox to change its image
to one of the images in the array depending on events that it registers
for...

I'm having trouble storing an array of images though,

I've tried Image[] but this doesn't work correctly, I've tried
ImageList.ImageCollection but this doesn't save images once you've
selected them, I've tried ShouldSerialize procedure, that didn't help.

The only thing I've got to work is adding an ImageList, but I dont
particulally want that as I want customers to be able to drop a
PictureBox onto the canvas and just set the images in the property
panal, not mess around adding an ImageList etc...

any ideas?

Thanks,
Kris Wragg

Apr 24 '06 #1
1 7794
Just to add this is what I've tried so far with no luck:

private Image[] myImages;
public Image[] MyImages
{
get { return myImages; }
set { myImages = value; }
}

this returns an error when trying to add a new image in the property grid i
recieve:

"Cannot create an instance of System.Drawing.Image because it is an abstract
class."

public ImageList.ImageCollection MyImageList
{
get { return imageList.Images; }
//set { iconList.Images = value; } // this doesn't work
}

this throws an error after selecting a new image to be added and says:
"Parameter must be of type Image. Parameter name: value"
Apr 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Anthony Boudouvas | last post: by
3 posts views Thread by Tom Foster | last post: by
5 posts views Thread by SeanT | last post: by
reply views Thread by Sarika | last post: by
7 posts views Thread by Brian | last post: by
2 posts views Thread by JR | last post: by
2 posts views Thread by =?Utf-8?B?S2VuTg==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.