Wednesday, October 3

Slide Show Windows Form Application

Download Here: Image Slide Show
c# Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;

namespace imageShow
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
           

            timer1.Enabled = true;
           // int i = 1;
            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Interval = (2000);
        }
        int i = 1;
        private void timer1_Tick(object sender, EventArgs e)
        {
            pictureBox1.BackgroundImage = Image.FromFile(@"images\"+i.ToString()+".jpg");
            i++;
            if (i == 8)
            {
                i = 1;
            }
        }

    }
}

No comments:

Post a Comment