|
-
February 22nd, 2009, 04:20 PM
#1
Reducing CPU Usage while moving images
Hi everyone, i'm pretty new to C#, and i'm using .NET 2.0.
I'm building a small game involving a moving background. The background is constantly moving by Timer, and consists of 2 pictureboxes - an upper bound and a lower bound.
I just move the picture boxes using the row
picUpperBound.Left -= 3
Or something of the sorts.
When i move one picture, the form's drawing mechanism can handle it. but when i add another image to move, the cpu usage of my program bumps to 50%. I was wondering why exactly does this happen, and how can i fix this?
(I'm guessing it has something to do with the form constantly redrawing the images)
Thanks in advance,
Sagie
P.S. Both images need to move at the same pace, so maybe there is some way of making the form Invalidate after both have moved, instead of redrawing itself with each Picturebox's movement.
Last edited by Gordi0075000; February 22nd, 2009 at 11:27 PM.
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
|