9.WinForm练习--图片的上一张和下一张

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

创新互联主要从事网站设计制作、网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务建湖,10多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

    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]);
    }
}

}


网页题目:9.WinForm练习--图片的上一张和下一张
链接URL:http://scyanting.com/article/piigeh.html