Fix wxStaticBox for dark mode with double buffering

Set custom painting mode for dark mode in MSWSetDarkOrLightMode()
because custom painting mode is not set in Create() when double
buffering.

Fixes #27004.

Closes #27007.
This commit is contained in:
Steve Cornett
2026-09-16 00:42:50 +02:00
committed by Vadim Zeitlin
parent 8eea7bebf9
commit e9d032d517
2 changed files with 15 additions and 0 deletions
+2
View File
@@ -78,6 +78,8 @@ public:
protected:
virtual wxWindowList GetCompositeWindowParts() const override;
virtual void MSWSetDarkOrLightMode(SetMode setmode) override;
// return the region with all the windows inside this static box excluded
WXHRGN MSWGetRegionWithoutChildren();
+13
View File
@@ -95,6 +95,19 @@ bool wxStaticBox::Create(wxWindow *parent,
return true;
}
void wxStaticBox::MSWSetDarkOrLightMode(SetMode setmode)
{
wxStaticBoxBase::MSWSetDarkOrLightMode(setmode);
// Set custom painting because the native control does not support dark mode.
//
// Note that it's not useful to check if we're using dark mode now because
// we must either be starting to use it now or had been using it at some
// point for this function to be called and once custom painting is
// enabled, calling this function doesn't do anything anyhow.
UseCustomPaint();
}
bool wxStaticBox::ShouldUseCustomPaint() const
{
// When not using double buffering, we paint the box ourselves by default