samedi 27 juin 2015

What speed should i set the timer interval to be "normal speed" when playing images ?

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

namespace Player_Manager
{
    public partial class ScreenShotsPlayer : Form
    {
        FileInfo[] images;
        DirectoryInfo di1;
        int current = 0;

        public ScreenShotsPlayer()
        {
            InitializeComponent();

            di1 = new DirectoryInfo(@"e:\screenshots");
            images = di1.GetFiles("*.bmp");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if(pictureBox1.Image!=null)
        {
            var img = pictureBox1.Image;  
            pictureBox1.Image = null;     
            pictureBox1.Image.Dispose(); 
        }

        current = (current >= images.Length - 1) ? 0 : ++current;
        pictureBox1.Image = new Bitmap(images[current].FullName);
        pictureBox1.Refresh();
        }
    }
}

I have a timer in the designer. When it was set to 100ms it was too fast. When it set to 1000ms as it is now it's too slow.

I have 1200 images that i play in the pictureBox. And i wonder what speed should be a normal speed ?

Aucun commentaire:

Enregistrer un commentaire