X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/99f22294f53e419f6b31abdbb744f6f7a5959e08..cd15bcaf50ead53ccf9d50965312f0dc754affb4:/samples/erase/erase.cpp?ds=sidebyside diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index 96e21c3b6f..37fc81bb88 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -362,10 +362,16 @@ MyCanvas::MyCanvas(wxFrame *parent) void MyCanvas::DoPaint(wxDC& dc) { + PrepareDC(dc); + if ( m_eraseBgInPaint ) { dc.SetBackground(*wxLIGHT_GREY); - dc.Clear(); + + // Erase the entire virtual area, not just the client area. + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(GetBackgroundColour()); + dc.DrawRectangle(GetVirtualSize()); dc.DrawText("Background erased in OnPaint", 65, 110); } @@ -387,15 +393,11 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) if ( m_useBuffer ) { wxAutoBufferedPaintDC dc(this); - PrepareDC(dc); - DoPaint(dc); } else { wxPaintDC dc(this); - PrepareDC(dc); - DoPaint(dc); } }