+ bool haveRefreshed = false;
+
+#if wxUSE_UXTHEME
+ if ( !UseBgCol() && !GetParent()->UseBgCol() )
+ {
+ // Don't use DrawThemeBackground
+ }
+ else if ( !UseBgCol() && majorVersion >= 6 )
+ {
+ wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive();
+ if ( theme )
+ {
+ wxUxThemeHandle hTheme(this, L"REBAR");
+
+ RECT clipRect = r;
+
+ // Draw the whole background since the pattern may be position sensitive;
+ // but clip it to the area of interest.
+ r.left = 0;
+ r.right = clientSize.x;
+ r.top = 0;
+ r.bottom = clientSize.y;
+
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
+ HRESULT hr = theme->DrawThemeBackground(hTheme, GetHdcOf(*impl), 0, 0, & r, & clipRect);
+ if ( hr == S_OK )
+ haveRefreshed = true;
+ }
+ }
+#endif
+
+ if (!haveRefreshed)
+ dc.DrawRectangle(rectItem);
+ }
+
+ if ( rectCtrl.Intersects(rectItem) )
+ {