diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 904cbda0aa..37a7b4585b 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -524,6 +524,13 @@ MyCanvas::MyCanvas(MyFrame *parent) m_useBuffer = false; m_showBBox = false; m_sizeDIP = wxSize(0, 0); + + Bind(wxEVT_SYS_COLOUR_CHANGED, [this](wxSysColourChangedEvent& event) { + event.Skip(); + + if ( m_show == File_ShowSystemColours ) + Refresh(); + }); } void MyCanvas::DrawTestBrushes(wxDC& dc) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 1ef6f514c5..b4396c5282 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -5106,6 +5106,13 @@ bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture) bool wxWindowMSW::HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam) { + // Check for the special case of changing the system light/dark mode. + if ( lParam && wxStrcmp((TCHAR*)lParam, wxT("ImmersiveColorSet")) == 0 ) + { + // Forward to the existing function generating an event for this. + HandleSysColorChange(); + } + // despite MSDN saying "(This message cannot be sent directly to a window.)" // we need to send this to child windows (it is only sent to top-level // windows) so {list,tree}ctrls can adjust their font size if necessary