With what function can i update a form? Cause sometimes the painting of the window is going really slow. So i want to decide when to repaint the window form. How can i do that??
Printable View
With what function can i update a form? Cause sometimes the painting of the window is going really slow. So i want to decide when to repaint the window form. How can i do that??
use the Refresh() method
I think the GUI is painted slow because i have a multithreaded application.
One AsyncCallback thread, for the sockets connection.
A timer for input events and another thread for rendering the game to the screen.
Besides that i have a few User Controls that are drawn on top of the game.
These User Controls are repainted VERY slow. The game itself and the input engine etc runs very smooth.
Any idea how i could make the User Controls run smooth too??
Nobody any idea?? :(
Yeh i do. I also have Application.DoEvents(). But that's not helping at all.
I think my threads are messing up the thread that handles the UI. I used a few delegates, but no background workers... But on the other hand, by threads are async... Well anyway i'm so confused right now...
using DoEvents() in .NET is a bad idea and is *almost* never warranted. Also, I would use Invalidate() instead of Refresh() to repaint a control.
That said, it's hard to help without knowing what your code is doing. You may be doing too much inside of your OnPaint handler, you may be refreshing too often, hard to say without seeing code. You can always upload your project here.
Probably not the issue unless the worker threads are set to a higher priority and are starving the UI thread.
With regard to Application.DoEvents(). This is usually used to pump messages within a single threaded app doing a bunch of work in the UI thread that really should be a multithreaded app.
Because your app is multithreaded, you definitely shouldn't need DoEvents, unless..... your UI thread is blocked waiting for one of the worker threads to complete the work. If that is the case, remove the blockage.
Try to boost the priority of your main UI thread.