Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I want to create an animation moving object .. in order to move this object i need to update the coordinates x and y or one of them, the problem is the object is jamb to the final position with no smooth moving animation as suppose to... I used thread sleep but doesn't just make the code freeze then the object jamb.. Here is the not working part of the code

public void t_Tick(object sender, EventArgs e)
{
    if (flag)
    {
        for (int i = 0; i < 100; i = i + 1)
        {
            x-position = x-position + 3;
            Invalidate();
            Thread.Sleep(5000);//instead of stop for 5 second and continue the loop is stop 5 second and go to i=100 the final value in the loop
        }
        flag = false;
    }
}
share|improve this question
    
From what you are saying it sounds like your nnew value is coming in as 99 so the integrator is going to 100 next. – Cubicle.Jockey 16 mins ago
    
Thank you for response, nnew is equal to 0 – user6425922 13 mins ago
    
Please provide more code as there is not enough information to go by. What event is t_Tick set to? When and how is flag set? – Cubicle.Jockey 10 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.