The problem is that you are working outside of the windows message model. Further reading:

http://en.wikipedia.org/wiki/Message...rosoft_Windows

Short explanation; you are doing your drawing in the wrong place. You should be doing all of your drawing inside of a Control's Paint event (or by overriding OnPaint()).

What is happening is that your drawing code runs, you see the update, and then a WM_PAINT message comes through. When this occurs the Control's OnPaint method is called (the method that calls the Paint event) and, since you are not drawing in that method, your drawing is overwritten by the new update.

You almost never need to call CreateGraphics. Also, what you are doing could potentially cause a memory problem as you are not Dispose()'ing of your Graphics object that is created when you call CreateGraphics. So:

1. Move your drawing code into the Paint event for your control and use the supplied Graphics object to draw to (e.Graphics).
2. Read up a bit on the windows message model and how to draw objects in C#.