首页 > Windows开发 > 详细

c# picturebox 幻灯片效果

时间:2021-04-12 22:37:57      阅读:38      评论:0      收藏:0      [点我收藏+]

 

技术分享图片

 

 

        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 幻灯片效果

原文:https://www.cnblogs.com/yaoyue68/p/14649400.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!