+ wxASSERT( !IsTopLevel() );
+
+ wxPoint pos = GetPosition();
+
+ AdjustForParentClientOrigin( pos.x, pos.y, 0 );
+
+ // Adjust DC logical origin
+ wxCoord org_x, org_y, x, y;
+ dc.GetLogicalOrigin( &org_x, &org_y );
+ x = org_x + pos.x;
+ y = org_y + pos.y;
+ dc.SetLogicalOrigin( x, y );
+
+ // Adjust draw rect
+ rect.x = pos.x;
+ rect.y = pos.y;
+
+ // Let parent draw the background
+ parent->EraseBackground( dc, rect );
+
+ // Restore DC logical origin
+ dc.SetLogicalOrigin( org_x, org_y );
+ }
+ else
+ {
+ // Draw background ouselves
+ EraseBackground( dc, rect );