From: Vadim Zeitlin Date: Sun, 10 Feb 2013 16:13:53 +0000 (+0000) Subject: Erase the entire virtual area of the window in the erase sample. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/963f64fb949652fb0de2522d7422a412c102dab8?ds=sidebyside Erase the entire virtual area of the window in the erase sample. Just clearing the DC is not enough when the window is scrolled, so clear the entire virtual area. We should be able to optimize it by clearing just the rectangle currently scrolled into view but this is at least correct, i.e. doesn't result in corrupted display, even if it's suboptimal. See #14917. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73493 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index 96e21c3b6f..307f639df9 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -365,7 +365,11 @@ void MyCanvas::DoPaint(wxDC& 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); }