You are painting on the child window (i.e., the static window) from the WM_PAINT of the parent. That's usually poor practice; the child window should do all of its own painting, in response to WM_PAINT messages sent to the child.

In addition, you are calling BeginPaint and EndPaint twice. They should be called only once in any one WM_PAINT procedure.

Mike