c#索引超出范围异常(图像列表)

时间:2015-01-10 17:59:19

标签: c# list

我的图像列表有点问题。有人能解释我的错误吗?

    public static List<Image> Img  = new List<Image>();
    int i;

    public AlegereImagine()
    {
        InitializeComponent();
    }

    public void pictureBox1_Click(object sender, EventArgs e)
    {
        AlegereImagine.Img [0] = Properties.Resources.image1;
        AlegereImagine.Img [1] = Properties.Resources.image22;
        AlegereImagine.Img [2] = Properties.Resources.image3;
        AlegereImagine.Img [3] = Properties.Resources.image4;
        AlegereImagine.Img [4] = Properties.Resources.image5;
        AlegereImagine.Img [5] = Properties.Resources.image6;
    }

    private void button2_Click(object sender, EventArgs e)
    {
        Imagine.Image = AlegereImagine.Img [1];
    }

0 个答案:

没有答案