Note that there are some explanatory texts on larger screens.

plurals
  1. POMove images with timer
    primarykey
    data
    text
    <p>I've written a code to move images from specific locations with <code>timer</code> and <code>pictureBox</code>.</p> <p>But my code doesn't work properly because images don't move on the path I want to.</p> <p>what I want is:</p> <pre><code>- create images from points (10,Y0). - move horizontally right to reach point (500,Y0). - move vertically down or up to reach point (500,750) and stop here for example 7 second. - then, move again horizontally right and go to point (700,750) and stop here for example 8 second. - then, move again horizontally right and go to point (750,750). - at this point, if (complete == true) the `pictureBox` must hide and back to (10,Y0) - if (complete == false) then if (up == true) - move vertically up to reach point (750,900) and and - move horizontally right and go to (900,900) and stop here for example 10 second. - then, then, move again horizontally left and go to point (500,900). - then, move vertically down to reach point (500,750). else if (down == true) - move vertically down to reach point (750,600) and and - move horizontally right and go to (900,600) and stop here for example 10 second. - then, then, move again horizontally left and go to point (500,600). - then, move vertically up to reach point (500,750). </code></pre> <p>I've written some codes but as I said, It's doesn't move correctly...</p> <p>one more thing: how I can implement the waits??! (when reach for exapmle (900,600) we must wait 10 second or wait until something outside allow the image to move).</p> <p>Please help me...</p> <p>Here is my codes so far:</p> <pre><code> private int k = 0; void timer_Tick(object sender, EventArgs e) { k++; int x = p.Location.X; int y = p.Location.Y; if (k &lt;= 250) p.Location = new Point(x + 2, y); else if (k &lt;= 400) { // if we are moving up of point (500,750) if (y &lt; 750) p.Location = new Point(x, y + 1); // if we are moving down of point (500,750) if (y &gt; 750) p.Location = new Point(x, y - 1); } // *** wait HERE. else if (k &lt;= 500) p.Location = new Point(x + 2, y); // *** wait HERE. else if (k &lt;= 550) p.Location = new Point(x + 2, y); else if (k &lt;= 700) { if (complete == true) p.Location = new Point(x, y + 1); else p.Location = new Point(x, y - 1); } else if (k &lt;= 800) p.Location = new Point(x + 2, y); // ***** wait HERE else if (k &lt;= 1200) p.Location = new Point(x - 2, y); else if (k &lt;= 1400) { if (complete == true) p.Location = new Point(x, y - 1); else p.Location = new Point(x, y + 1); } else timer1.Stop(); } } private void button1_Click(object sender, EventArgs e) { timer1.Start(); timer1.Interval = 15; timer1.Tick += new EventHandler(timer_Tick); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload