|
-
Apr 28th, 2014, 12:32 PM
#1
[RESOLVED] Drawing using BackGroundWorker, I don't see my where I'm wrong.
I'm using drawing routines that are all called by the .Paint Event of my Control.
The calculation of the objects is done in the Routine "SystemTracks_Simulation", also the positional regions where the objects have been and are now get invalidated. This routine is called once for each Frame.
If I use that routine in the GUI thread, everything works as it should. All the different objects are drawn.
However if I use a BackGroundWorker-thread to call the "SystemTracks_Simulation" the respective objects are most of the time not drawn. Only if I do a ReScale (complete Redraw, i.e. Invalidate without Region) the objects are drawn. If the simulation in running the objects are only shown momentarily (which is the problem), if it isn't running the redraw will show all the objects.
Here are the codelines that call the routine either by the BGW or directly.
Code:
If Not MainForm.BackgroundSystemTracksWorker.IsBusy Then
MainForm.BackgroundSystemTracksWorker.RunWorkerAsync()
Else
debug_schreiben("SystemTracks_Sim ausgefallen! ")
End If
or
Code:
SystemTracks_Simulation()
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
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
|