|
-
August 28th, 2009, 07:35 AM
#1
update form
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??
-
August 28th, 2009, 07:59 AM
#2
-
August 28th, 2009, 08:20 AM
#3
Re: update form
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??
-
August 28th, 2009, 03:17 PM
#4
Re: update form
Nobody any idea??
-
August 28th, 2009, 03:27 PM
#5
Re: update form
 Originally Posted by vivendi
Nobody any idea?? 
Are you using double buffering already ?
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
August 28th, 2009, 03:50 PM
#6
Re: update form
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...
-
August 28th, 2009, 05:40 PM
#7
Re: update form
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.
-
August 28th, 2009, 06:50 PM
#8
Re: update form
 Originally Posted by vivendi
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.
-
August 29th, 2009, 05:18 AM
#9
Re: update form
Try to boost the priority of your main UI thread.
-
August 29th, 2009, 06:10 AM
#10
Re: update form
 Originally Posted by vcdebugger
Try to boost the priority of your main UI thread.
As a test sure, but generally this isn't a good idea in production.
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
|