namespace _9.图片的上一张和下一张
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

    private void Form1_Load(object sender, EventArgs e)
    {
        pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox1.Image = Image.FromFile(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic\1.jpg");
    }
    //获得图片文件夹的全路径
    string[] path=Directory.GetFiles(@"C:\Users\Administrator.USER-20180925HC\Desktop\pic");
    int i=0;
    private void btnDownPic_Click(object sender, EventArgs e)
    {
       i++;
        if (i == path.Length)
        {
            i = 0;
        }
        pictureBox1.Image = Image.FromFile(path[i]);
    }

    private void btnUpPic_Click(object sender, EventArgs e)
    {
        i--;
        if (i < 0)
        {
            i = path.Length - 1;
        }
        pictureBox1.Image = Image.FromFile(path[i]);
    }
}

}