]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/bmpbuttn.cpp
non-PCH build fix (according to Tinderbox).
[wxWidgets.git] / src / msw / bmpbuttn.cpp
index 8f0acde1a926be3f57df3f6682e5d81eee5d6770..d4848e4d5fc96c61c0c468beb60e624aae8b0e78 100644 (file)
 #ifndef WX_PRECOMP
     #include "wx/log.h"
     #include "wx/dcmemory.h"
+    #include "wx/image.h"
 #endif
 
 #include "wx/msw/private.h"
-#include "wx/image.h"
 
 #include "wx/msw/uxtheme.h"
 
@@ -408,8 +408,7 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item)
         }
 
         // draw the bitmap
-        wxClientDC dst;
-        dst.SetHDC((WXHDC) hDC, false);
+        wxDCTemp dst((WXHDC)hDC);
         dst.DrawBitmap(*bitmap, x1, y1, true);
 
         return true;
@@ -619,8 +618,10 @@ wxSize wxBitmapButton::DoGetBestSize() const
             // them and it just makes them appear larger than needed
             if ( !HasFlag(wxBORDER_NONE) )
             {
-                marginH = margins.cxLeftWidth + margins.cxRightWidth;
-                marginV = margins.cyTopHeight + margins.cyBottomHeight;
+                // we need 2 extra pixels for the focus rectangle, without them
+                // it's overwritten by the bitmap itself
+                marginH = margins.cxLeftWidth + margins.cxRightWidth + 2;
+                marginV = margins.cyTopHeight + margins.cyBottomHeight + 2;
             }
         }
         else