C \ # 그림 위 에 다음

2206 단어 그림.
namespace   
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        //                
        string[] path = Directory.GetFiles(@"C:\Users\yn\Pictures\C#\");
        int i = 0;
        //   
        private void button2_Click(object sender, EventArgs e)
        {
            //    ,i++,path[i]       
            i++;
            if (i>path.Length-1)
            {
                i = 0;//     ,     
            }
            pictureBox1.Image = Image.FromFile(path[i]);
        }
        //   
        private void button1_Click(object sender, EventArgs e)
        {
            i--;
            if (i<0)
            {
                i = path.Length-1;
            }
            pictureBox1.Image = Image.FromFile(path[i]);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //     ,      
            pictureBox1.Image = Image.FromFile(@"C:\Users\yn\Pictures\C#\31113.png");
        }
    }
}

좋은 웹페이지 즐겨찾기