diff --git a/docs/changes.txt b/docs/changes.txt index 521cb08e29..39a3f576e9 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -94,6 +94,7 @@ wxMSW: - Fix crash when using wxCHMHelpController() in 64 bit builds (Xlord2). - Fix MDI menu display after failure to create a child frame (troelsk). - Fix wxScreenDC::GetSize() with multiple monitors (iwbnwif). +- Fix background colour returned by wxTextCtrl::GetStyle() (Andreas Falkenhahn). wxOSX: diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 9b4124e9da..847c18921e 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -3054,8 +3054,13 @@ bool wxTextCtrl::GetStyle(long position, wxTextAttr& style) #if wxUSE_RICHEDIT2 if ( m_verRichEdit != 1 ) { - // cf.dwMask |= CFM_BACKCOLOR; - style.SetBackgroundColour(wxColour(cf.crBackColor)); + // Notice that, surprisingly, CFM_BACKCOLOR is still set in the mask + // even when CFE_AUTOBACKCOLOR is set in the effects, indicating that + // the background colour is not used. + if ( !(cf.dwEffects & CFE_AUTOBACKCOLOR) && (cf.dwMask & CFM_BACKCOLOR) ) + { + style.SetBackgroundColour(wxColour(cf.crBackColor)); + } } #endif // wxUSE_RICHEDIT2