Fix wxTextCtrl::SetFont() with wxTE_RICH when in dark mode

Explicitly set the correct (for dark mode) colours when setting the new
style, otherwise the control would use black text on almost black
background.

See #25856.
This commit is contained in:
Vadim Zeitlin
2025-10-06 22:41:30 +02:00
parent b6ce3f6dee
commit e068efbc14
+9
View File
@@ -3131,6 +3131,15 @@ bool wxTextCtrl::SetFont(const wxFont& font)
// the default font for it.
wxTextAttr attr;
attr.SetFont(font);
// In dark mode we also need to set the colours explicitly, just as we
// do for the colours of the control itself in Create().
if ( wxMSWDarkMode::IsActive() )
{
attr.SetTextColour(GetForegroundColour());
attr.SetBackgroundColour(GetBackgroundColour());
}
SetStyle(-1, -1, attr);
}