]> git.saurik.com Git - wxWidgets.git/commitdiff
Erase the entire virtual area of the window in the erase sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Feb 2013 16:13:53 +0000 (16:13 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Feb 2013 16:13:53 +0000 (16:13 +0000)
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

samples/erase/erase.cpp

index 96e21c3b6fbd9c4211b077f18ee1735e863d7973..307f639df9cf1a425551c1cc727a2a3798b71a0b 100644 (file)
@@ -365,7 +365,11 @@ void MyCanvas::DoPaint(wxDC& dc)
     if ( m_eraseBgInPaint )
     {
         dc.SetBackground(*wxLIGHT_GREY);
     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);
     }
 
         dc.DrawText("Background erased in OnPaint", 65, 110);
     }