mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-23 23:13:12 +08:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user