// common part of the 3 functions above: pass wxNullColour to use the
// appropriate background colour (meaning ours or our parents) or a fixed
// one
- WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
+ virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
// another WM_CTLCOLOR-related function: override this to return the brush
// which should be used to paint the control background by default
int sizeFlags = wxSIZE_AUTO);
virtual wxSize DoGetBestSize() const;
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
+ virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText)
};
return msStyle;
}
+WXHBRUSH wxStaticText::DoMSWControlColor(WXHDC pDC, wxColour colBg)
+{
+ // If this control has a non-standard fg colour but still has the standard
+ // bg then we need to also give it a non-standard bg otherwise the fg
+ // setting has no effect.
+ WXHBRUSH hbr = wxControl::DoMSWControlColor(pDC, colBg);
+ if (!hbr && m_hasFgCol)
+ {
+ hbr = MSWGetBgBrushForChild(pDC, this);
+ }
+ return hbr;
+}
+
wxSize wxStaticText::DoGetBestSize() const
{
wxClientDC dc(wx_const_cast(wxStaticText *, this));