vivendi
August 28th, 2009, 07:35 AM
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??
|
Click to See Complete Forum and Search --> : update form vivendi August 28th, 2009, 07:35 AM 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?? dannystommen August 28th, 2009, 07:59 AM use the Refresh() method vivendi August 28th, 2009, 08:20 AM 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?? vivendi August 28th, 2009, 03:17 PM Nobody any idea?? :( JonnyPoet August 28th, 2009, 03:27 PM Nobody any idea?? :(Are you using double buffering already ? vivendi August 28th, 2009, 03:50 PM 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... BigEd781 August 28th, 2009, 05:40 PM 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. Arjay August 28th, 2009, 06:50 PM I think the GUI is painted slow because i have a multithreaded application. 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. vcdebugger August 29th, 2009, 05:18 AM Try to boost the priority of your main UI thread. Arjay August 29th, 2009, 06:10 AM Try to boost the priority of your main UI thread.As a test sure, but generally this isn't a good idea in production. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |