+void wxWindowMSW::OnEraseBackground(wxEraseEvent& event)
+{
+ switch ( GetBackgroundStyle() )
+ {
+ default:
+ wxFAIL_MSG( _T("unexpected background style") );
+ // fall through
+
+ case wxBG_STYLE_CUSTOM:
+ // don't skip the event here, custom background means that the app
+ // is drawing it itself in its OnPaint()
+ break;
+
+ case wxBG_STYLE_SYSTEM:
+#if wxUSE_NOTEBOOK && wxUSE_UXTHEME && !defined(__WXUNIVERSAL__)
+ // automatically apply the tab control theme background to any
+ // child panels to have the same look as the native property sheet
+ // dialogs
+ if ( !IsOfStandardClass() )
+ {
+ for ( wxWindow *win = this; win; win = win->GetParent() )
+ {
+ wxNotebook *nbook = wxDynamicCast(win, wxNotebook);
+ if ( nbook )
+ {
+ nbook->DoEraseBackground(event);
+ return;
+ }
+ }
+ }
+#endif // wxUSE_NOTEBOOK
+ event.Skip();
+ break;
+
+ case wxBG_STYLE_COLOUR:
+ // we have a fixed solid background colour, do use it
+ RECT rect;
+ ::GetClientRect(GetHwnd(), &rect);
+
+ HBRUSH hBrush = ::CreateSolidBrush(
+ wxColourToPalRGB(GetBackgroundColour()));
+ if ( !hBrush )
+ wxLogLastError(wxT("CreateSolidBrush"));
+
+ HDC hdc = GetHdcOf((*event.GetDC()));
+
+ ::FillRect(hdc, &rect, hBrush);
+ ::DeleteObject(hBrush);
+ }
+}
+