错误1 “WindowsFormsApplication1.Form1”不包含“lst”的定义,并且找不到可接受类型为“WindowsFormsApplication1.Form1”的第一个参数的扩展方法“lst”(是否缺少 using 指令或程序集引用?) C:\Documents and Settings\Administrator\桌面\program\showmain\WindowsFormsApplication1\Form1.cs 61 47 WindowsFormsApplication1
       List<Image> lst = new List<Image>();
                lst.Add(Image.FromFile("C:\\choujiang\\毕福剑.jpg"));
                lst.Add(Image.FromFile("C:\\choujiang\\布什.jpg"));
                lst.Add(Image.FromFile("C:\\choujiang\"成龙.jpg"));
                lst.Add(Image.FromFile("C:\\choujiang\\郭晶晶.jpg"));
                lst.Add(Image.FromFile("C:\\choujiang\\胡锦涛.jpg"));
                lst.Add(Image.FromFile("C:\\choujiang\\刘翔.jpg"));
                this.pictureBox1.Image = this.lst[i];

解决方案 »

  1.   

    this.pictureBox1.Image = lst[i];
      

  2.   

    你这个lst应该是某个方法里的局部变量吧,想要用this,要写成类的成员,好好看下书啊,这是很基础的东西
      

  3.   


    “this.”查找的是class作用域的变量,而不是方法语句内的局部变量。另外,这个程序一旦发布,不怕北河蟹吗?
      

  4.   


    this.pictureBox1.Image = this.lst[i]; 
    i应该是一个确定的数值吧
      

  5.   

    楼主的lst是在方法体内声明的,不是类的实例成员..
      

  6.   

    List<Image> lst = new List<Image>();
    定义为属性
    this指代类对象本身,用于访问本类的所有常量、字段、属性和方法成员,而且不管访问元素是任何访问级别。因为,this仅仅局限于对象内部,对象外部是无法看到的,这就是this的基本思想。另外,静态成员不是对象的一部分,因此不能在静态方法中引用this。 
      

  7.   

     this.pictureBox1.Image = this.lst[i];
    改成 this.pictureBox1.Image = lst;