Sleep or delay functioning
I am using a picture box that draws circles (points) in a 2-dimensional plot. Each point is shown on the plot separately through using a "For-Next" statement. In fact, the coordinates x(i),y(i) are calculated and then displayed on the plot by an Ellipse drawing method. In order to provide a realistic sense of drawing, I need to make a delay between tandem drawings of circles. So I used the code system.threading.thread.sleep(1000); however, the whole thread halts and stops drawing and then deliver the plotted graph as a whole at end. Instead of the code, I used a timer; but it didn't work properly, too. I also employed the stopwatch object; it however did not work, too. I also couldn't find a (API) sleep function to add to my program. I have used creating objects , e.g. font object, color object, pen object, etc., and deleting the objects (by Dispose method and set Nothing) after they are not needed to exist at that immediate time. Do you know any solution? Do you know about Windows API Sleep function in VB.Net ? Thank you for your response.
The correct option is to use a Timer. If it didn't work when you tried it then you did it wrong. If you show us what you did and tell us what happened then we can probably help you fix it.
Note that the actual drawing should be done in the Paint event handler of the control you're drawing on. The Timer would be used to force the Paint event to be raised by calling Invalidate on that control.
Thank you very much for your reply. I will check your solution.
Originally Posted by jmcilhinney