+WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
+ WXUINT WXUNUSED(message),
+ WXWPARAM WXUNUSED(wParam),
+ WXLPARAM WXUNUSED(lParam))
+{
+#if wxUSE_CTL3D
+ if ( m_useCtl3D )
+ {
+ HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
+ return (WXHBRUSH) hbrush;
+ }
+#endif // wxUSE_CTL3D
+
+ HDC hdc = (HDC)pDC;
+ if (GetParent()->GetTransparentBackground())
+ SetBkMode(hdc, TRANSPARENT);
+ else
+ SetBkMode(hdc, OPAQUE);
+
+ wxColour colBack = GetBackgroundColour();
+
+ if (!IsEnabled() && (GetWindowStyle() & wxTE_MULTILINE) == 0)
+ colBack = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+
+ ::SetBkColor(hdc, wxColourToRGB(colBack));
+ ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
+
+ wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
+
+ return (WXHBRUSH)brush->GetResourceHandle();
+}
+
+// In WIN16, need to override normal erasing because
+// Ctl3D doesn't use the wxWindows background colour.
+#ifdef __WIN16__
+void wxTextCtrl::OnEraseBackground(wxEraseEvent& event)
+{
+ wxColour col(m_backgroundColour);
+
+#if wxUSE_CTL3D
+ if (m_useCtl3D)
+ col = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW);
+#endif
+
+ RECT rect;
+ ::GetClientRect(GetHwnd(), &rect);
+
+ COLORREF ref = PALETTERGB(col.Red(),
+ col.Green(),
+ col.Blue());
+ HBRUSH hBrush = ::CreateSolidBrush(ref);
+ if ( !hBrush )
+ wxLogLastError(wxT("CreateSolidBrush"));
+
+ HDC hdc = (HDC)event.GetDC()->GetHDC();
+
+ int mode = ::SetMapMode(hdc, MM_TEXT);
+
+ ::FillRect(hdc, &rect, hBrush);
+ ::DeleteObject(hBrush);
+ ::SetMapMode(hdc, mode);
+
+}
+#endif
+