Fix background drawing in EVT_ERASE_BACKGROUND handler in erase sample.

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
This commit is contained in:
Vadim Zeitlin 2013-01-21 16:37:09 +00:00
parent 22a3b6e4b2
commit 99f22294f5

View 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);