From: Vadim Zeitlin Date: Thu, 11 Nov 1999 00:25:57 +0000 (+0000) Subject: 1. wxStaticBox doesn't draw over the underlying controls any more X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3f2711d5c119962a9fcb7198ebf351930d646e23?hp=e0473f5f5acddc18b39f9a2a1aff0de5038e7aae 1. wxStaticBox doesn't draw over the underlying controls any more 2. a couple of new helper functions in msw/private.h: wxColourToRGB and wxRGBToColour are handy to avoid writing horribly long and ugly RGB <-> wxColour conversions explicitly 3. modified wxDirDialog to be more comprehensible (to me), hopefully it also works better git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/control.h b/include/wx/control.h index 5b93250282..bfdda99063 100644 --- a/include/wx/control.h +++ b/include/wx/control.h @@ -34,8 +34,8 @@ public: virtual void Command(wxCommandEvent &event); protected: - // creates the controls (invokes wxWindowBase::CreateBase) and adds it to - // the list of parents children + // creates the control (calls wxWindowBase::CreateBase inside) and adds it + // to the list of parents children bool CreateControl(wxWindowBase *parent, wxWindowID id, const wxPoint& pos, @@ -50,6 +50,18 @@ protected: #endif const wxString& name); + // an overloaded version for the controls without validators + bool CreateControl(wxWindowBase *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) + { + return CreateControl(parent, id, pos, size, style, + wxDefaultValidator, name); + } + // inherit colour and font settings from the parent window void InheritAttributes(); }; diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index 0005193c7c..da27f5ac32 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -76,8 +76,8 @@ protected: bool MSWCreateControl(const wxChar *classname, WXDWORD style); // determine the extended styles combination for this window (may slightly - // modify styl parameter) - WXDWORD GetExStyle(WXDWORD& style) const; + // modify style parameter, this is why it's non const) + WXDWORD GetExStyle(WXDWORD& style, bool *want3D) const; private: DECLARE_EVENT_TABLE() diff --git a/samples/dialogs/dialogs.cpp b/samples/dialogs/dialogs.cpp index 5445609834..06adc34fb2 100644 --- a/samples/dialogs/dialogs.cpp +++ b/samples/dialogs/dialogs.cpp @@ -286,7 +286,11 @@ void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) ) void MyFrame::DirChoose(wxCommandEvent& WXUNUSED(event) ) { - wxDirDialog dialog(this, "Testing directory picker", ""); + // pass some initial dir to wxDirDialog + wxString dirHome; + wxGetHomeDir(&dirHome); + + wxDirDialog dialog(this, "Testing directory picker", dirHome); if (dialog.ShowModal() == wxID_OK) { diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 28c1b64a30..8490b93ee0 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -889,6 +889,7 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) ) textData.AddFile( "/file2.txt" ); */ wxDropSource source(textData, this + #ifdef __WXMSW__ ,wxCURSOR_PENCIL, // for copy wxCURSOR_SPRAYCAN, // for move @@ -1043,15 +1044,23 @@ void DnDFrame::OnPasteBitmap(wxCommandEvent& WXUNUSED(event)) void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event)) { #ifdef __WXMSW__ - wxFileDataObject *dobj = new wxFileDataObject; - wxFileDialog dialog(this, "Select a file to copy", "", "", "All files (*.*)|*.*", 0); - if ( dialog.ShowModal() == wxID_OK ) + wxArrayString filenames; + while ( dialog.ShowModal() == wxID_OK ) + { + filenames.Add(dialog.GetPath()); + } + + if ( !filenames.IsEmpty() ) { - wxString filename = dialog.GetPath(); - dobj->AddFile(filename); + wxFileDataObject *dobj = new wxFileDataObject; + size_t count = filenames.GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + dobj->AddFile(filenames[n]); + } wxClipboardLocker locker; if ( !locker ) @@ -1062,12 +1071,12 @@ void DnDFrame::OnCopyFiles(wxCommandEvent& WXUNUSED(event)) { if ( !wxTheClipboard->AddData(dobj) ) { - wxLogError("Can't copy file to the clipboard"); + wxLogError("Can't copy file(s) to the clipboard"); } else { - wxLogStatus(this, "File '%s' copied to the clipboard", - filename.c_str()); + wxLogStatus(this, "%d file%s copied to the clipboard", + count, count == 1 ? "" : "s"); } } } diff --git a/src/msw/control.cpp b/src/msw/control.cpp index f610c69d77..652b4929f7 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -45,11 +45,11 @@ END_EVENT_TABLE() // Item members wxControl::wxControl() { - m_backgroundColour = *wxWHITE; - m_foregroundColour = *wxBLACK; + m_backgroundColour = *wxWHITE; + m_foregroundColour = *wxBLACK; #if WXWIN_COMPATIBILITY - m_callback = 0; + m_callback = 0; #endif // WXWIN_COMPATIBILITY } @@ -60,9 +60,17 @@ wxControl::~wxControl() bool wxControl::MSWCreateControl(const wxChar *classname, WXDWORD style) { + // VZ: if someone could put a comment here explaining what exactly this is + // needed for, it would be nice... + bool want3D; + + // all controls have these childs (wxWindows creates all controls visible + // by default) + style |= WS_CHILD | WS_VISIBLE; + m_hWnd = (WXHWND)::CreateWindowEx ( - GetExStyle(style), // extended style + GetExStyle(style, &want3D), // extended style classname, // the kind of control to create NULL, // the window name style, // the window style @@ -82,6 +90,14 @@ bool wxControl::MSWCreateControl(const wxChar *classname, WXDWORD style) return FALSE; } +#if wxUSE_CTL3D + if ( want3D ) + { + Ctl3dSubclassCtl(GetHwnd()); + m_useCtl3D = TRUE; + } +#endif // wxUSE_CTL3D + // subclass again for purposes of dialog editing mode SubclassWin(m_hWnd); @@ -168,26 +184,25 @@ void wxControl::OnEraseBackground(wxEraseEvent& event) // might flicker. RECT rect; - ::GetClientRect((HWND) GetHWND(), &rect); + ::GetClientRect(GetHwnd(), &rect); - HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), - GetBackgroundColour().Green(), - GetBackgroundColour().Blue())); - int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT); + HBRUSH hBrush = ::CreateSolidBrush(wxColourToRGB(GetBackgroundColour())); - ::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush); + HDC hdc = GetHdcOf((*event.GetDC())); + int mode = ::SetMapMode(hdc, MM_TEXT); + + ::FillRect(hdc, &rect, hBrush); ::DeleteObject(hBrush); - ::SetMapMode((HDC) event.GetDC()->GetHDC(), mode); + ::SetMapMode(hdc, mode); } -WXDWORD wxControl::GetExStyle(WXDWORD& style) const +WXDWORD wxControl::GetExStyle(WXDWORD& style, bool *want3D) const { - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; + WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, want3D); - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. - if ( want3D || wxStyleHasBorder(m_windowStyle) ) + // Even with extended styles, need to combine with WS_BORDER for them to + // look right. + if ( *want3D || wxStyleHasBorder(m_windowStyle) ) style |= WS_BORDER; return exStyle; diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 5434b5d0d7..3523789d38 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -6,154 +6,185 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- #ifdef __GNUG__ -#pragma implementation "dirdlg.h" + #pragma implementation "dirdlg.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #ifndef WX_PRECOMP -#include -#include "wx/defs.h" -#include "wx/utils.h" -#include "wx/dialog.h" -#include "wx/dirdlg.h" + #include "wx/utils.h" + #include "wx/dialog.h" + #include "wx/dirdlg.h" #endif -#if (defined(__WIN95__) && !defined(__GNUWIN32__))||defined(wxUSE_NORLANDER_HEADERS) -#include "shlobj.h" // Win95 shell +#include "wx/msw/private.h" + +#if defined(__WIN95__) && \ + (!defined(__GNUWIN32__) || defined(wxUSE_NORLANDER_HEADERS)) + #define CAN_COMPILE_DIRDLG +//#else: we provide a stub version which doesn't do anything #endif -#include "wx/msw/private.h" -#include "wx/cmndata.h" +#ifdef CAN_COMPILE_DIRDLG + #include "shlobj.h" // Win95 shell +#endif -#include -#include -#include +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- -#define wxDIALOG_DEFAULT_X 300 -#define wxDIALOG_DEFAULT_Y 300 +#ifndef MAX_PATH + #define MAX_PATH 4096 // be generuous +#endif + +// ---------------------------------------------------------------------------- +// wxWindows macros +// ---------------------------------------------------------------------------- #if !USE_SHARED_LIBRARY -IMPLEMENT_CLASS(wxDirDialog, wxDialog) + IMPLEMENT_CLASS(wxDirDialog, wxDialog) #endif -static int CALLBACK -BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) - { - TCHAR szDir[MAX_PATH]; - - switch(uMsg) - { - case BFFM_INITIALIZED: - // We have put m_path into pData. - // TRUE -> passing char *, not dir id. - SendMessage(hwnd,BFFM_SETSELECTION,TRUE,pData); - break; - - case BFFM_SELCHANGED: - // Set the status window to the currently selected path. - if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir)) - { - SendMessage(hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir); - } - break; +// ---------------------------------------------------------------------------- +// private functions prototypes +// ---------------------------------------------------------------------------- + +// free the parameter +static void ItemListFree(LPITEMIDLIST pidl); - default: - break; - } - return 0; - } +// the callback proc for the dir dlg +static int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, + LPARAM pData); +// ============================================================================ +// implementation +// ============================================================================ -wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, -// const wxString& caption, - const wxString& defaultPath, - long style, const wxPoint& pos) +// ---------------------------------------------------------------------------- +// wxDirDialog +// ---------------------------------------------------------------------------- + +wxDirDialog::wxDirDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultPath, + long WXUNUSED(style), + const wxPoint& WXUNUSED(pos)) { m_message = message; -// m_caption = caption; - m_dialogStyle = style; m_parent = parent; - m_path = defaultPath; + m_path = defaultPath; } -int wxDirDialog::ShowModal(void) +int wxDirDialog::ShowModal() { - // Unfortunately Gnu-Win32 doesn't yet have COM support -#if (defined(__WIN95__) && !defined(__GNUWIN32__))||defined(wxUSE_NORLANDER_HEADERS) - HWND hWnd = 0; - if (m_parent) hWnd = (HWND) m_parent->GetHWND(); - +#ifdef CAN_COMPILE_DIRDLG BROWSEINFO bi; - LPTSTR lpBuffer; -// LPITEMIDLIST pidlPrograms; // PIDL for Programs folder - LPITEMIDLIST pidlBrowse; // PIDL selected by user - LPMALLOC pMalloc = NULL; - - HRESULT result = ::SHGetMalloc(&pMalloc); - - if (result != NOERROR) - return wxID_CANCEL; - - // Allocate a buffer to receive browse information. - if ((lpBuffer = (LPTSTR) pMalloc->Alloc(MAX_PATH)) == NULL) + bi.hwndOwner = m_parent ? GetHwndOf(m_parent) : NULL; + bi.pidlRoot = NULL; + bi.pszDisplayName = NULL; + bi.lpszTitle = m_message.c_str(); + bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT; + bi.lpfn = BrowseCallbackProc; + bi.lParam = (LPARAM)m_path.c_str(); // param for the callback + + LPITEMIDLIST pidl = SHBrowseForFolder(&bi); + + if ( bi.pidlRoot ) + { + ItemListFree((LPITEMIDLIST)bi.pidlRoot); + } + + if ( !pidl ) { - pMalloc->Release(); + // Cancel button pressed return wxID_CANCEL; } -/* - // Get the PIDL for the Programs folder. - if (!SUCCEEDED(SHGetSpecialFolderLocation( - parent->GetSafeHwnd(), CSIDL_PROGRAMS, &pidlPrograms))) { - pMalloc->Free(lpBuffer); - pMalloc->Release(); + BOOL ok = SHGetPathFromIDList(pidl, m_path.GetWriteBuf(MAX_PATH)); + m_path.UngetWriteBuf(); + + ItemListFree(pidl); + + if ( !ok ) + { + wxLogLastError("SHGetPathFromIDList"); + return wxID_CANCEL; - } -*/ - - // Fill in the BROWSEINFO structure. - bi.hwndOwner = hWnd; - bi.pidlRoot = NULL; // pidlPrograms; - bi.pszDisplayName = lpBuffer; - bi.lpszTitle = m_message; // BC++ 4.52 says LPSTR, not LPTSTR? - bi.ulFlags = 0; - bi.lpfn = BrowseCallbackProc; - bi.lParam = (LPARAM)m_path.c_str(); - - // Browse for a folder and return its PIDL. - pidlBrowse = SHBrowseForFolder(&bi); - - int id = wxID_OK; - if (pidlBrowse != NULL) { - - // Show the display name, title, and file system path. - if (SHGetPathFromIDList(pidlBrowse, lpBuffer)) - m_path = lpBuffer; - - // Free the PIDL returned by SHBrowseForFolder. - pMalloc->Free(pidlBrowse); } - else - id = wxID_CANCEL; - - // Clean up. -// pMalloc->Free(pidlPrograms); - pMalloc->Free(lpBuffer); - pMalloc->Release(); - - return id; -#else - return wxID_CANCEL; -#endif + + return wxID_OK; +#else // !CAN_COMPILE_DIRDLG + return wxID_CANCEL; +#endif // CAN_COMPILE_DIRDLG/!CAN_COMPILE_DIRDLG +} + +// ---------------------------------------------------------------------------- +// private functions +// ---------------------------------------------------------------------------- + +static int CALLBACK +BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) +{ + switch(uMsg) + { + case BFFM_INITIALIZED: + // sent immediately after initialisation and so we may set the + // initial selection here + // + // wParam = TRUE => lParam is a string and not a PIDL + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData); + break; + + case BFFM_SELCHANGED: + { + // Set the status window to the currently selected path. + TCHAR szDir[MAX_PATH]; + if ( SHGetPathFromIDList((LPITEMIDLIST)lp, szDir) ) + { + SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szDir); + } + } + break; + + //case BFFM_VALIDATEFAILED: -- might be used to provide custom message + // if the user types in invalid dir name + } + + return 0; +} + + +static void ItemListFree(LPITEMIDLIST pidl) +{ + if ( pidl ) + { + LPMALLOC pMalloc; + SHGetMalloc(&pMalloc); + if ( pMalloc ) + { + pMalloc->Free(pidl); + pMalloc->Release(); + } + else + { + wxLogLastError("SHGetMalloc"); + } + } } diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 7ef4f3bddd..2c150f4866 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: statbox.cpp +// Name: msw/statbox.cpp // Purpose: wxStaticBox // Author: Julian Smart // Modified by: @@ -9,27 +9,38 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + #ifdef __GNUG__ -#pragma implementation "statbox.h" + #pragma implementation "statbox.h" #endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -#include "wx/window.h" -#include "wx/msw/private.h" - #ifndef WX_PRECOMP -#include "wx/app.h" -#include "wx/dcclient.h" + #include "wx/app.h" + #include "wx/dcclient.h" #endif #include "wx/statbox.h" +#include "wx/msw/private.h" + +// ---------------------------------------------------------------------------- +// wxWin macros +// ---------------------------------------------------------------------------- + #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) @@ -39,64 +50,31 @@ END_EVENT_TABLE() #endif -/* - * Group box - */ - -bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, - const wxString& label, - const wxPoint& pos, - const wxSize& size, - long style, - const wxString& name) +// ============================================================================ +// implementation +// ============================================================================ + +// ---------------------------------------------------------------------------- +// wxStaticBox +// ---------------------------------------------------------------------------- + +bool wxStaticBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& label, + const wxPoint& pos, + const wxSize& size, + long style, + const wxString& name) { - SetName(name); - - if (parent) parent->AddChild(this); - - SetBackgroundColour(parent->GetBackgroundColour()) ; - SetForegroundColour(parent->GetForegroundColour()) ; - - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - m_windowStyle = style; - - long msStyle = BS_GROUPBOX | WS_CHILD | WS_VISIBLE ; // GROUP_FLAGS; - - bool want3D; - WXDWORD exStyle = Determine3DEffects(0, &want3D) ; + if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) + return FALSE; - HWND wx_button = - CreateWindowEx(exStyle, wxT("BUTTON"), (const wxChar *)label, msStyle, - 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, - wxGetInstance(), NULL); -#if wxUSE_CTL3D - if (want3D) - { - Ctl3dSubclassCtl(wx_button); - m_useCtl3D = TRUE; - } -#endif - - m_hWnd = (WXHWND)wx_button; - - // Subclass again for purposes of dialog editing mode - SubclassWin(GetHWND()); + if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX) ) + return FALSE; - SetFont(parent->GetFont()); + SetSize(pos.x, pos.y, size.x, size.y); - SetSize(x, y, width, height); - ShowWindow(wx_button, SW_SHOW); - - return TRUE; + return TRUE; } wxSize wxStaticBox::DoGetBestSize() @@ -119,29 +97,33 @@ WXHBRUSH wxStaticBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, WXLPARAM lParam) { #if wxUSE_CTL3D - if ( m_useCtl3D ) - { - HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); - return (WXHBRUSH) hbrush; - } -#endif + if ( m_useCtl3D ) + { + HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam); + return (WXHBRUSH) hbrush; + } +#endif // wxUSE_CTL3D - if (GetParent()->GetTransparentBackground()) - SetBkMode((HDC) pDC, TRANSPARENT); - else - SetBkMode((HDC) pDC, OPAQUE); + HDC hdc = (HDC)pDC; + if (GetParent()->GetTransparentBackground()) + SetBkMode(hdc, TRANSPARENT); + else + SetBkMode(hdc, OPAQUE); - ::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); - ::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue())); + const wxColour& colBack = GetBackgroundColour(); + ::SetBkColor(hdc, wxColourToRGB(colBack)); + ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); - wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID); + wxBrush *brush= wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID); - // Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush - // has a zero usage count. -// backgroundBrush->RealizeResource(); - return (WXHBRUSH) backgroundBrush->GetResourceHandle(); + return (WXHBRUSH)brush->GetResourceHandle(); } +// VZ: this is probably the most commented function in wxWindows, but I still +// don't understand what it does and why. Wouldn't it be better to _never_ +// erase the background here? What would we lose if we didn't do it? +// (FIXME) + // Shouldn't erase the whole window, since the static box must only paint its // outline. void wxStaticBox::OnEraseBackground(wxEraseEvent& event) @@ -162,25 +144,17 @@ void wxStaticBox::OnEraseBackground(wxEraseEvent& event) // few other circumstances where it matters about child clipping. But what about painting onto // to panel, inside a groupbox? Doesn't appear, because the box wipes it out. wxWindow *parent = GetParent(); - if ( parent && parent->GetHWND() && (::GetWindowLong((HWND) parent->GetHWND(), GWL_STYLE) & WS_CLIPCHILDREN) ) + if ( parent && parent->GetHWND() && + (::GetWindowLong(GetHwndOf(parent), GWL_STYLE) & WS_CLIPCHILDREN) ) { // TODO: May in fact need to generate a paint event for inside this // control's rectangle, otherwise all controls are going to be clipped - // ugh. - HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); - int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT); - - RECT rect; - ::GetClientRect(GetHwnd(), &rect); - ::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush); - ::DeleteObject(hBrush); - ::SetMapMode((HDC) event.GetDC()->GetHDC(), mode); - } - else - { + // let wxControl::OnEraseBackground() do the job event.Skip(); } + //else: do *not* call event.Skip() or wxControl will erase the background } long wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)