Click here to Skip to main content
15,916,215 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So lets say I made a program to draw a bunch of rectangles on the screen, and then I have a circle which I can move around the screen with arrow keys.

Is there a way to tell C# to only redraw the circle when I move it instead of having to redraw absolutely everything on the screen? It just seems a bit wasteful to have to redraw every rectangle on the screen when I'm only moving the circle :(
Posted

1 solution

Have the "background" rectangles painted to a bitmap.
Then at each circle-update overlay the circle onto a copy of that bitmap and blit it(display it).
 
Share this answer
 
Comments
Raztor0 9-Oct-10 13:37pm    
Okay so I figured out how to display the rectangles as a bitmap, but I can't figure out what you mean be "overlay the circle onto a copy of the bitmap". Am I supposed to redraw the bitmap every time and draw the circle over it?

Also, if it means anything, the circle in my case is actually a .PNG, don't know if it changes anything but just thought I should mention it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900