指定的参数已超出有效值的范围。参数名: “0”不是“index”的有效值。 
隐藏     在 System.Windows.Forms.Design.ImageListDesigner.OriginalImageCollection.get_Item(Int32 index)
在 System.Windows.Forms.Design.ImageListDesigner.OriginalImageCollection.SetKeyName(Int32 index, String name)代码:
this.imageList2.ImageStream = (ImageListStreamer) resources.GetObject("imageList2.ImageStream");
            
            this.imageList2.Images.SetKeyName(0, "货物.png");
            this.imageList2.Images.SetKeyName(1, "货车.png");
            this.imageList2.Images.SetKeyName(2, "Mac_Folder_32.png");
            this.imageList2.Images.SetKeyName(3, "Mac_Folder_12.png");
            this.imageList2.Images.SetKeyName(4, "Mac_Folder_41.png"); 不知道什么原因

解决方案 »

  1.   

    this.imageList2.Images.SetKeyName(0, "货物.png");
    吧这个删了!   或者写this.imageList2.Images.SetKeyName(5, "货物.png");
      

  2.   

    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;   this.imageList1 = new ImageList(this.components);
       this.imageList2 = new ImageList(this.components);
      //this.imageList1.Images.SetKeyName(0, "货物.png");
      this.imageList1.Images.SetKeyName(1, "货车.png");指定的参数已超出有效值的范围。参数名: “1”不是“index”的有效值。 
      

  3.   

    源代码
    using Business;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using WeightSystem;
    namespace MineralMarketing
    {
    partial class GuideForm
    {
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.IContainer components = null; /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
    protected override void Dispose(bool disposing)
    {
    if (disposing && (components != null))
    {
    components.Dispose();
    }
    base.Dispose(disposing);
    } #region Windows 窗体设计器生成的代码 /// <summary>
    /// 设计器支持所需的方法 - 不要
    /// 使用代码编辑器修改此方法的内容。
    /// </summary>


    private void InitializeComponent()
            {
                 this.components = new Container();
                 resources = new ComponentResourceManager(typeof(MineralMarketing.GuideForm));
                this.imageList1 = new ImageList(this.components);
                this.imageList2 = new ImageList(this.components);            this.imageList1.ImageStream = (ImageListStreamer) resources.GetObject("imageList1.ImageStream");
                this.imageList1.TransparentColor = Color.Transparent;
               this.imageList1.Images.SetKeyName(0, "货物.png");
                this.imageList1.Images.SetKeyName(1, "货车.png");
               .
               .
                this.imageList1.Images.SetKeyName(20, "报表1.jpg");
            
                this.imageList2.ImageStream = (ImageListStreamer)resources.GetObject("imageList2.ImageStream");
                this.imageList2.TransparentColor = Color.Transparent;
                this.imageList2.Images.SetKeyName(0, "货物.png");
                this.imageList2.Images.SetKeyName(1, "货车.png");
               .
               .
                this.imageList2.Images.SetKeyName(20, "报表1.jpg");
                base.AutoScaleDimensions = new SizeF(6f, 12f);
                base.ResumeLayout(false);
                base.PerformLayout();
            }
            private ImageList imageList1;
            private ImageList imageList2;
            private ComponentResourceManager resources;
    #endregion
    }
    }SetKeyName 就是不能使用函数设置
      

  4.   

    http://social.msdn.microsoft.com/Forums/zh-CN/2212/thread/6099c8d0-3e12-408f-9cba-71a1d466959d/