c# picturebox 幻灯片效果

2021/4/12 20:27:23

本文主要是介绍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 幻灯片效果的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程