From 62b6539eea352b65a62eab1908719bc12804c44a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Oct 2021 17:23:37 +0100 Subject: [PATCH] Select the button size appropriate for the current DPI initially Don't just update the bitmaps size when we receive the DPI changed event, but also use size appropriate for the current DPI initially. --- src/msw/anybutton.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/msw/anybutton.cpp b/src/msw/anybutton.cpp index 3661da374c..0364d24ee5 100644 --- a/src/msw/anybutton.cpp +++ b/src/msw/anybutton.cpp @@ -105,9 +105,10 @@ extern wxWindowMSW *wxWindowBeingErased; // From src/msw/window.cpp class wxButtonImageData: public wxObject { public: - explicit wxButtonImageData(const wxBitmapBundle& normalBundle) - : m_bitmapSize(normalBundle.GetDefaultSize()) + wxButtonImageData(wxWindow* btn, const wxBitmapBundle& normalBundle) { + m_bitmapSize = normalBundle.GetDefaultSize() * btn->GetDPIScaleFactor(); + m_bitmapBundles[wxAnyButton::State_Normal] = normalBundle; } @@ -178,7 +179,7 @@ class wxODButtonImageData : public wxButtonImageData { public: wxODButtonImageData(wxAnyButton *btn, const wxBitmapBundle& bitmapBundle) - : wxButtonImageData(bitmapBundle) + : wxButtonImageData(btn, bitmapBundle) { SetBitmap(GetBitmapFromBundle(bitmapBundle), wxAnyButton::State_Normal); @@ -252,7 +253,7 @@ public: // we must be constructed with the size of our images as we need to create // the image list wxXPButtonImageData(wxAnyButton *btn, const wxBitmapBundle& bitmapBundle) - : wxButtonImageData(bitmapBundle), + : wxButtonImageData(btn, bitmapBundle), m_hwndBtn(GetHwndOf(btn)) { InitImageList();