]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix background drawing in EVT_ERASE_BACKGROUND handler in erase sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 21 Jan 2013 16:37:09 +0000 (16:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 21 Jan 2013 16:37:09 +0000 (16:37 +0000)
Clear the DC before moving its offset to ensure that it's cleared entirely and
also draw the background using the virtual, not client, size.

See #14917.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/erase/erase.cpp

index eb54c2ede3e43c215d7df50bbf84e7e132dbdb23..96e21c3b6fbd9c4211b077f18ee1735e863d7973 100644 (file)
@@ -419,12 +419,12 @@ void MyCanvas::OnEraseBackground( wxEraseEvent& event )
     wxDC& dc = *event.GetDC();
     dc.SetPen(*wxGREEN_PEN);
 
-    PrepareDC( dc );
-
     // clear any junk currently displayed
     dc.Clear();
 
-    const wxSize size = GetClientSize();
+    PrepareDC( dc );
+
+    const wxSize size = GetVirtualSize();
     for ( int x = 0; x < size.x; x += 15 )
     {
         dc.DrawLine(x, 0, x, size.y);