-
October 23rd, 2016, 12:07 AM
#1
Sleep or delay functioning in VB.Net
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.
-
October 23rd, 2016, 05:03 PM
#2
Re: Sleep or delay functioning in VB.Net
Sounds like you're putting the sleep into the wrong part of the code, but you'll need to post the code to be sure.
-
October 24th, 2016, 01:29 AM
#3
Re: Sleep or delay functioning in VB.Net
At a guess I would think that you are doing your drawing on the UI thread and not allowing the UI to update the display.
You might want to try adding a refresh after each draw and before each sleep.
Always use [code][/code] tags when posting code.
-
October 24th, 2016, 06:55 AM
#4
Re: Sleep or delay functioning in VB.Net
Originally Posted by DataMiser
At a guess I would think that you are doing your drawing on the UI thread and not allowing the UI to update the display.
You might want to try adding a refresh after each draw and before each sleep.
is this only in UI case???
-
October 24th, 2016, 08:37 AM
#5
Re: Sleep or delay functioning in VB.Net
As Arjay mentioned in post #2, it would be helpful if you could post the code used.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
November 10th, 2016, 03:29 PM
#6
Re: Sleep or delay functioning in VB.Net
Originally Posted by 2kaud
As Arjay mentioned in post #2, it would be helpful if you could post the code used.
fine.. got it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|