"is not a valid value for 'value'. 'value' should be between 1 and 256"

T

Tamir Khason

Is there limitation of ImageList to 256 px?
While trying to change the size to more then 256 I recieve the exception of
"value out of range". While trying to change the size on run-time I'm
recieveing error "
is not a valid value for 'value'. 'value' should be between 1 and 256"

How to rid over it?
 
G

Guest

Hi Tamir,

Thank you for posting in the community!

Yes, the ImageList control only allows the 'value' of the ImageSize between
1 and 256. This is by design. Please refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemWindowsFormsImageListClassImageSizeTopic.asp

If you still want to use image that size is greater than 256, I think you
should get rid of ImageList control.

Can you show me what thing you exactly want to do? Why you want to use
ImageList to store your image.

May be I can find a workaround for you. Thanks.

========================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
T

Tamir Khason

Thank you for response,
I have serias of images (avg 100) to be used in dynamicly created controls
PictureBox
Instead of use
pb.Image = new
Bitmap(this.GetType().Assembly.GetManifestResourceStream(st));

I'd like to add them by seeking imagelist
 
G

Guest

Hi Tamir,

Thanks very much for your feedback.

I see your concern.

Actually, ImageList control is designed for relative "small" images, that
is why the ImageSize property can only allow value no more than 256. So you
can not use ImageList control to contain your "big" images.

As your images are larger than 256X256, and the number of the images is
also not small. So the total images size will also be relative large. So I
think it is not a good idea to store 100 images in the application exe file.

I think you may store the images in the a directory in the same folder with
the application. Then, at runtime, you can dynamicly load the image and use
them.
I think this will result in a better design and performance.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Hi Tamir,

Does my reply make sense to you? Is your problem resolved?

If you still have any concern, please feel free to feedback, I will help
you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

I am trying to address a very similar situation. In a VB 6 program I used the imaglist to hold 6 different images. They weren't very large but they were 200 X 900. In VB6 there was no size limitation and it worked well. I am now trying to do the same thing with very similar images but have to find another method. I have read on embedding the files as a resourse and using them. I was just curious if that is the best way to address it. In particular, based upon the response to a radiobutton click it want a certain image placed in a picture box. With the radiobutton it was very ease to take that index and just use it in the imagelist to insert the correct image to the picturebox. The images shoud not ever really change (never say never) and I would like to embed them so people don't have to have them externally loaded. I also don't want users to be able to access or change them.

I think I have 2 options now:
1) Use the control from mscomctl.ocx version 6.0 (vb 6 control) that allows the larger bitmaps
2) Use the embedded resources and load up an array with the internal resources
3) Or some other better way????

I would appreciate any other ideas that would work nice and simple (I think the old imagelist was pretty simple and clean) and opinions on the current ideas.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top