- // preserve the existing background, otherwise we'd erase anything the user
- // code had drawn in its EVT_ERASE_BACKGROUND handler when we do the Blit
- // back below
- dcm.Blit(0, rect.GetTop(),
- sz.x, rect.GetBottom() - rect.GetTop() + 1,
- &dc,
- 0, rect.GetTop());
+ if ( m_eraseBgInOnPaint )
+ {
+ dcm.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
+ dcm.Clear();
+
+ m_eraseBgInOnPaint = false;
+ }
+ else // someone has already erased the background, keep it
+ {
+ // preserve the existing background, otherwise we'd erase anything the
+ // user code had drawn in its EVT_ERASE_BACKGROUND handler when we do
+ // the Blit back below
+ dcm.Blit(0, rect.GetTop(),
+ sz.x, rect.GetBottom() - rect.GetTop() + 1,
+ &dc,
+ 0, rect.GetTop());
+ }