From b1bdb95ee8c3268e7e4bf0cc66fb50c1e65fb5ec Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 13 Jan 2023 19:45:01 +0100 Subject: [PATCH] Use sizers in the notebook sample for better DPI change handling Even simple static texts need to be put inside sizers to allow them to update their size when the DPI changes, as they remain too small for the new (higher) DPI otherwise when the sample window is moved from a standard to high DPI monitor. See #23088. --- samples/notebook/notebook.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index 8fa3b86a56..57500b8c74 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -114,9 +114,11 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent) panel->SetHelpText("An empty panel"); #endif - (void) new wxStaticText( panel, wxID_ANY, - "This page intentionally left blank", - wxPoint(10, 10) ); + wxSizer* const s = new wxBoxSizer(wxVERTICAL); + s->Add(new wxStaticText( panel, wxID_ANY, + "This page intentionally left blank" ), + wxSizerFlags().Expand().DoubleBorder()); + panel->SetSizer(s); return panel; } @@ -143,9 +145,12 @@ wxPanel *CreateInsertPage(wxBookCtrlBase *parent) #endif panel->SetBackgroundColour( wxColour( "MAROON" ) ); - (void) new wxStaticText( panel, wxID_ANY, - "This page has been inserted, not added.", - wxPoint(10, 10) ); + + wxSizer* const s = new wxBoxSizer(wxVERTICAL); + s->Add(new wxStaticText( panel, wxID_ANY, + "This page has been inserted, not added." ), + wxSizerFlags().Expand().DoubleBorder()); + panel->SetSizer(s); return panel; }