新手问个关于ImageList控件问题。
本人是想用ImageList存一组照片,然后通过PictureBox显示出来。

然后我也在ImageList控件里添加2张照片

也写了一些代码

最后运行就变这样了
我也加过好几张图片了,总说我索引超出范围。
------解决方案--------------------mageList1.ImageSize = new Size(200, 150);
去掉就可以了。
------解决方案--------------------说错了
你试试看1和2,不是从0开始的。
------解决方案--------------------来自MSDN:因为设置 ImageSize 属性会导致重新创建句柄,所以应在设置 Images 属性之前设置 ImageSize。在已创建了 ImageList 的句柄时,在设置 Images 属性之后在代码中设置 ColorDepth 或 ImageSize 属性会导致为 Images 属性设置的图像集被删除。
http://msdn.microsoft.com/zh-SG/library/system.windows.forms.imagelist.imagesize