Why when clicking play to play animation it doesn't change points position?
<p>What i need it do is this:</p>

<ol>
<li><p>checkBox1 checked: Do not show pictureBox image background but only the pixels and when moving the trackBar to the right or using timer3 tick event update the images so when its moving to the right it will load the next image with the different pixels location but without showing the image backgorund.</p></li>
<li><p>checkBox is not checked: Show in the pictureBox the background image and pixels togeather and this is working if the checkBox is not checked i see both background image and the pixels and its working good in timer3 tick and when using the arrow keys in the scroll event !</p></li>
</ol>

<p>So the only problem now is number 1.</p>

<p>I think its now working good in the trackBar1 scroll event when i use the arrow keys left and right while the checkBox is checked or not checked and its doing what i need.</p>

<p>This is the scroll event and the SetPicture function codes:</p>

<pre><code>private void trackBar1_Scroll(object sender, EventArgs e)
        {

            currentFrameIndex = trackBar1.Value;
            textBox1.Text = "Frame Number : " + trackBar1.Value;
            wireObject1.woc.Set(wireObjectAnimation1.GetFrame(currentFrameIndex));

            trackBar1.Minimum = 0;
            trackBar1.Maximum = fi.Length - 1;
            if (checkBox1.Checked)
            {
                setpicture(trackBar1.Value);
                Graphics g = Graphics.FromImage(pictureBox1.Image);
                g.Clear(SystemColors.Control);
                pictureBox1.Invalidate();
            }
            else
            {
                setpicture(trackBar1.Value);
            }
            pictureBox1.Refresh();

            button1.Enabled = false;
            button2.Enabled = false;
            button3.Enabled = false;
            button4.Enabled = false;
            button8.Enabled = false;
            SaveFormPicutreBoxToBitMapIncludingDrawings(currentFrameIndex);
            return;



        }
</code></pre>

<p>SetPicture:</p>

<pre><code>private void setpicture(int indx)
        {
            if (fi == null)
            {

            }
            else
            {
                if (indx &gt;= 0 &amp;&amp; indx &lt;= trackBar1.Maximum &amp;&amp; fi.Length &gt; indx)
                {
                    try
                    {
                        label19.ForeColor = Color.Red;
                        fileToolStripMenuItem.Enabled = true;
                        label19.Visible = false;
                        label14.Visible = true;
                        label15.Visible = true;
                        label23.Visible = true;
                        trackBar1.Enabled = true;
                        using (FileStream fs = new FileStream(fi[indx].FullName, FileMode.Open))
                        {
                            this.label23.Visible = true;
                            this.label23.Text = fi[indx].Name;
                            Image img = null;
                            Bitmap bmp = null;
                            Image imgOLd = null;

                            try
                            {

                                img = Image.FromStream(fs);
                                bmp = new Bitmap(img);

                                imgOLd = this.pictureBox1.Image;
                                this.pictureBox1.Image = bmp;
                                if (imgOLd != null)
                                    imgOLd.Dispose();

                                img.Dispose();
                                img = null;
                            }
                            catch
                            {
                                if (img != null)
                                    img.Dispose();
                                if (bmp != null)
                                    bmp.Dispose();
                                if (imgOLd != null)
                                    imgOLd.Dispose();
                            }
                        }
                    }
                    catch
                    {

                    }
                }
                else
                {
                    Image imgOLd = this.pictureBox1.Image;

                    if (imgOLd != null)
                    {
                        imgOLd.Dispose();
                        imgOLd = null;
                    }

                    Application.DoEvents();
                }
            }
        }
</code></pre>

<p>This is the checkBox checkedChanged event:</p>

<pre><code>private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                Graphics g = Graphics.FromImage(pictureBox1.Image);
                g.Clear(SystemColors.Control);
                pictureBox1.Invalidate();
            }
            else
            {
                pictureBox1.Load(fi[trackBar1.Value].FullName);
                pictureBox1.Invalidate();
            }
        }
</code></pre>

<p>Now the problem is when i click the Play button and then it start the timer3:</p>

<p>Play button code:</p>

<pre><code>private void btnPlay_Click(object sender, EventArgs e)
        {
            _files = new List&lt;FileInfo&gt;(); 
            _indx = 0;
            DirectoryInfo dir = new DirectoryInfo(filesForanimation);

            if (_files == null)
                _files = new List&lt;FileInfo&gt;();

            fi1 = dir.GetFiles("*.bmp");
            _files.AddRange(fi1);

            _files = _files.OrderBy(f =&gt; f.LastWriteTime).ToList();
            button14.ForeColor = Color.Red;
            button13.ForeColor = Color.Black;
            button12.ForeColor = Color.Black;
            timer3.Start();
            button13.Enabled = true;
            button13.Text = "Pause";
            button12.Enabled = true;
            trackBar1.Maximum = fi1.Length;
            trackBar1.Minimum = 0;
        }
</code></pre>

<p>fi1 is FileInfo[] in the Form1 level.
_indx is int in the Form1 level.</p>

<p>This is the Timer3 tick event where hte problem now is.
When i click play i see the trackBar1 moving to the right over and over but if the checkBox is checked i dont see the pixels in the pictureBox changing the are in same location all the time. While if im using arrow keys to move the trackBar to the right or left the pixels i see the changes.</p>

<pre><code>private void timer3_Tick(object sender, EventArgs e)
        {
            try
            {
                Image iOLd = this.pictureBox1.Image;
                trackBar1.Value = _indx;
                label23.Text = _files[_indx].Name;
                if (checkBox1.Checked)
                {
                    Image img = Image.FromFile(_files[_indx].FullName);
                    this.pictureBox1.Image = img;
                    Graphics g = Graphics.FromImage(this.pictureBox1.Image);
                    g.Clear(SystemColors.Control);
                    pictureBox1.Invalidate();
                }
                else
                {
                    Image img = Image.FromFile(_files[_indx].FullName);
                    this.pictureBox1.Image = img;
                }
                if (iOLd != null)
                    iOLd.Dispose();
                _indx++;

                if (_indx &gt;= _files.Count)
                {
                    _indx = 0;
                    trackBar1.Value = 0;
                }
                timer3.Interval = Convert.ToInt32(numericUpDown1.Value); 
            }
            catch
            {

            }
        }
</code></pre>

<p>In the timer3 tick event in the area if the checkBox is checked i tried the code as it is now i also tried to use the SetPicture function as i did in the trakcBar scroll event but nothing helped. </p>

<p>This is the pictureBox paint event if its needed:</p>

<pre><code>private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            SolidBrush brush;
            Pen p=null;
           Point connectionPointStart;
           Point connectionPointEnd;
           Graphics g = e.Graphics;

           //Graphics bitmapGraphics = Graphics.FromImage(bmp);
           g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

               moveCounter++;
               label6.Text = moveCounter.ToString();

               brush = new SolidBrush(Color.Red);
               p = new Pen(brush);
               if (wireObject1 != null)
               {
                   for (int idx = 0; idx &lt; wireObject1.woc.Point_X.Count; ++idx)
                   {
                       Point dPoint = new Point((int)wireObject1.woc.Point_X[idx], (int)wireObject1.woc.Point_Y[idx]);
                       dPoint.X = dPoint.X - 5; // was - 2
                       dPoint.Y = dPoint.Y - 5; // was - 2
                       Rectangle rect = new Rectangle(dPoint, new Size(10, 10));
                       g.FillEllipse(brush, rect);

                   }

                   for (int i = 0; i &lt; wireObject1._connectionstart.Count; i++)
                   {

                       int startIndex = wireObject1._connectionstart[i];
                       int endIndex = wireObject1._connectionend[i];



                       connectionPointStart = new Point((int)wireObject1.woc.Point_X[startIndex], (int)wireObject1.woc.Point_Y[startIndex]);
                       connectionPointEnd = new Point((int)wireObject1.woc.Point_X[endIndex], (int)wireObject1.woc.Point_Y[endIndex]);
                       p.Width = 2;
                       g.DrawLine(p, connectionPointStart, connectionPointEnd);

                   }
               }
        }
</code></pre>
