string[] files = Directory.GetFiles("path");
            int size = files.Length;
            int index = new Random().Next(0,size);
            string file = files[index];

解决方案 »

  1.   

    你给picturebox赋随机值就好了
      

  2.   

    不要代码,给个思路吧。
    如果想12张图片都显示,就是没有重复的,那就要先将12张图片文件名放到一个数组里面,然后随机取数组里面的数放到一个新的数组里面,如果新的数组里面已包含,就在原先的数组里面将其排除,然后再随机取,直到完成,再循环新数组里面的值给picturebox,OK。
      

  3.   

    private void Form1_Load(object sender, EventArgs e)
            {
                string[] a = Directory.GetFiles(Directory.GetCurrentDirectory());
                Int32 random = new Random().Next(0, a.Length);
                this.pictureBox1.Load(Directory.GetCurrentDirectory() + a[random]);
            }