Update bitmap size automatically on DPI change in wxMSW wxToolBar

Remove the now unnecessary wxEVT_DPI_CHANGED event handler in the
sample.
This commit is contained in:
Vadim Zeitlin
2021-09-27 18:41:45 +01:00
parent 7337bf1da1
commit 9a578b9c8f
2 changed files with 4 additions and 12 deletions

View File

@@ -111,7 +111,6 @@ public:
void OnAbout(wxCommandEvent& event);
void OnSize(wxSizeEvent& event);
void OnDPIChanged(wxDPIChangedEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void OnToggleAnotherToolbar(wxCommandEvent& event);
@@ -242,7 +241,6 @@ enum
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_SIZE(MyFrame::OnSize)
EVT_DPI_CHANGED(MyFrame::OnDPIChanged)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
EVT_MENU(wxID_HELP, MyFrame::OnAbout)
@@ -698,16 +696,6 @@ void MyFrame::OnSize(wxSizeEvent& event)
}
}
void MyFrame::OnDPIChanged(wxDPIChangedEvent& event)
{
event.Skip();
// We check the DPI scaling factor when the toolbar is created, so just
// recreate it whenever DPI changes. We could also just update the tools
// bitmaps, but this is simpler and doesn't have any significant drawbacks.
RecreateToolbar();
}
void MyFrame::OnToggleToolbar(wxCommandEvent& WXUNUSED(event))
{
wxToolBar *tbar = GetToolBar();