- m_canvas = the_canvas;
- RECT updateRect1 = g_paintStruct.rcPaint;
- m_canvas->m_updateRect.x = updateRect1.left;
- m_canvas->m_updateRect.y = updateRect1.top;
- m_canvas->m_updateRect.width = updateRect1.right - updateRect1.left;
- m_canvas->m_updateRect.height = updateRect1.bottom - updateRect1.top;
-// m_canvas->m_paintHDC = m_staticPaintHDC ;
+ m_canvas = canvas;
+ if ( ms_PaintCount > 0 ) {
+ // it means that we've already called BeginPaint and so we must just
+ // reuse the same HDC (BeginPaint shouldn't be called more than once)
+ wxASSERT( ms_PaintHDC );
+
+ m_hDC = ms_PaintHDC;
+ ms_PaintCount++;
+ }
+ else {
+ ms_PaintHDC =
+ m_hDC = (WXHDC)::BeginPaint((HWND)m_canvas->GetHWND(), &g_paintStruct);
+ ms_PaintCount = 1;
+ m_hDCCount++;
+ }
+
+ SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));