gui: Fix about dialog logo DPI scaling

Also dynamically allocate the wxStaticBitmap control since its parent
window will delete it, which can cause issues.
This commit is contained in:
Jonathan Li 2019-11-25 15:50:37 +00:00 committed by lightningterror
parent 1dc5d07696
commit 363b87b334
2 changed files with 7 additions and 8 deletions

View File

@ -34,13 +34,15 @@ using namespace pxSizerFlags;
Dialogs::AboutBoxDialog::AboutBoxDialog(wxWindow* parent)
: wxDialogWithHelpers(parent, AddAppName(_("About %s")), pxDialogFlags())
, m_bitmap_logo(this, wxID_ANY, wxBitmap(EmbeddedImage<res_Logo>().Get()),
wxDefaultPosition, wxDefaultSize)
{
// Main layout
SetMinWidth(MSW_GetDPIScale() * 460);
const float scale = MSW_GetDPIScale();
SetMinWidth(scale * 460);
*this += m_bitmap_logo | StdCenter();
wxImage img = EmbeddedImage<res_Logo>().Get();
img.Rescale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH);
auto bitmap_logo = new wxStaticBitmap(this, wxID_ANY, wxBitmap(img));
*this += bitmap_logo | StdCenter();
#ifdef _WIN32
const int padding = 15;

View File

@ -60,9 +60,6 @@ namespace Dialogs
{
class AboutBoxDialog: public wxDialogWithHelpers
{
protected:
wxStaticBitmap m_bitmap_logo;
public:
AboutBoxDialog( wxWindow* parent=NULL );
virtual ~AboutBoxDialog() = default;