c# picturebox 幻灯片效果

 

c# picturebox 幻灯片效果

 

 

        private void Form1_Load(object sender, EventArgs e)  //打开加载的图片
        {
            pictureBox1.ImageLocation = @"D:\Users\yaoyue\Desktop\xlarge_YWB8_05760000420b1191.jpg";
            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
        }
        string[] path = Directory.GetFiles(@"D:\Users\yaoyue\Desktop\克期通督");  //directory  i必须放到外面
        int i;
        private void button2_Click_1(object sender, EventArgs e)  //上一页
        {
            if (i == path.Length-1)
            {
                pictureBox1.ImageLocation = path[i];
                i = 0;
            }
            else 
            {
                pictureBox1.ImageLocation = path[i];
                i++;
            }
        }
        private void button1_Click_1(object sender, EventArgs e)  //下一页
        {
            if (i==0)
            {
                pictureBox1.ImageLocation = path[0];
                i = path.Length-1;
            }
            else 
            {
                pictureBox1.ImageLocation = path[i];
                i--;
            }
        }

  

c# picturebox 幻灯片效果

上一篇:win10jdk怎样配置环境变量


下一篇:Nginx host wordpress无法找到restapi的问题