Re: Graphics ... almost working ... missing one line?




"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:39B2E477-E187-4736-897A-611A2960FDA3@xxxxxxxxxxxxxxxx
Peter,

What is in the code for play_animation? Are you looping through and repainting on every invocation of the loop? It seems like that is the case here.

What you really want to do is create a timer which you invalidate your picturebox on every tick (the frame rate of your animation will depend on the frequency of the timer).


Yes. I am looping through dozens of on-screen objects, updating their position. That's what my program does, and spends all its time. In the main animation loop, I still use a myBuffer.Render() command, as the drawBox.Invalidate() command flickers (even though it just does a myBuffer.Render() ).

I was told before (and I think by you) to use a timer in asynchronous thread. It didn't seem an issue in my app, as most people will want to run it flat out, so having two threads was more complexity that I didn't understand.

The annoying thing is that it is just a problem at start up of the Form. Everything else works brilliantly.

Is there some quick and dirty I can do for the start-up to make the form appear before the animation starts (or even finishes!)?

Or if I have to do this properly, can you refer me to a web page that might get me started?


.



Relevant Pages

  • Re: Graphics ... almost working ... missing one line?
    ... appear before the animation starts? ... What you really want to do is create a timer which you invalidate your picturebox on every tick. ... In the main animation loop, I still use a myBuffer.Rendercommand, as the drawBox.Invalidatecommand flickers ). ... I was told before to use a timer in asynchronous thread. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: question about thread scheduling
    ... I will try what you suggested, the reason that I didn't use the sleep method ... whatsoever to tamper with the timer tick. ... If the NN run in a different thread as the control loop ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Timer module for interpreter
    ... What I'd like to do is have a fall-back timer so that if some ... loop which is running the code. ... Presumably the flag set by the ... module and checked by the main interpreter loop would also have ...
    (comp.sys.acorn.programmer)
  • Re: Timer module for interpreter
    ... What I'd like to do is have a fall-back timer so that if some ... loop which is running the code. ... Several of my applications use SWI OS_CallAfter to set a routine to be ... intervals to allow cooperatively multi-task to continue. ...
    (comp.sys.acorn.programmer)
  • Re: How to create a synchronous call in a In-Process server
    ... I think you're going to have to use QueryUnload, but rather than a timer fired from that, I'd favor an event model where the activex component signals it is safe to unload it after a stop or unload request has been made. ... don't listen to anyone who says put a Sleep call in your DoEvents loop as that would make things worse. ... Private Sub Form1_Load ...
    (microsoft.public.vb.general.discussion)

Loading