X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f566b4fe822694a0b33e490edb730ede39d731ad..98672b4b9cb156c624a66efd5b3c1935a1d37de9:/samples/erase/erase.cpp diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index eeddaad927..9f159bbebc 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -171,7 +171,7 @@ END_EVENT_TABLE() MyCanvas::MyCanvas( MyFrame *parent ) : wxScrolledWindow( parent, -1, wxDefaultPosition, wxDefaultSize, - wxScrolledWindowStyle|wxNO_FULL_REPAINT_ON_RESIZE ) + wxScrolledWindowStyle|wxNO_FULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ) { SetScrollbars( 10, 10, 40, 100, 0, 0 ); } @@ -181,6 +181,30 @@ void MyCanvas::OnPaint( wxPaintEvent &event ) wxPaintDC dc(this); PrepareDC( dc ); +#if 0 + wxRegionIterator upd( GetUpdateRegion() ); + while (upd) + { + wxLogDebug( "Paint: %d %d %d %d", upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() ); + upd ++; + } +#endif + +#if 0 + wxSize size = GetSize(); + wxSize client_size = GetClientSize(); + wxLogDebug( "size %d %d client_size %d %d", size.x, size.y, client_size.x, client_size.y ); +#endif + + int i; + dc.SetPen( *wxWHITE_PEN ); + for (i = 0; i < 20; i += 2) + dc.DrawLine( i,i, i+100,i ); + + dc.SetPen( *wxWHITE_PEN ); + for (i = 200; i < 220; i += 2) + dc.DrawLine( i-200,i, i-100,i ); + wxRegion region( 110, 110, 80, 80 ); wxRegion hole( 130, 130, 40, 1 ); region.Intersect( hole ); @@ -188,6 +212,18 @@ void MyCanvas::OnPaint( wxPaintEvent &event ) dc.SetBrush( *wxRED_BRUSH ); dc.DrawRectangle( 100, 100, 200, 200 ); + + dc.DestroyClippingRegion(); + + dc.SetPen( *wxTRANSPARENT_PEN ); + + wxRegion strip( 110, 200, 30, 1 ); + wxRegionIterator it( strip ); + while (it) + { + dc.DrawRectangle( it.GetX(), it.GetY(), it.GetWidth(), it.GetHeight() ); + it ++; + } } void MyCanvas::OnEraseBackground( wxEraseEvent &event )