]> git.saurik.com Git - wxWidgets.git/commitdiff
don't erase the background to see the transparent images better
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 4 Mar 2003 02:10:27 +0000 (02:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 4 Mar 2003 02:10:27 +0000 (02:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/image/image.cpp

index a74abe5ba2c62e1fc912e5d4de771ea9a7cf9099..ef9f1914177ddfe32aef842d9443117a1f6cf356 100644 (file)
@@ -135,11 +135,15 @@ public:
         SetClientSize(bitmap.GetWidth(), bitmap.GetHeight());
     }
 
+    void OnEraseBackground(wxEraseEvent& WXUNUSED(event))
+    {
+        // do nothing here to be able to see how transparent images are shown
+    }
+
     void OnPaint(wxPaintEvent& WXUNUSED(event))
     {
         wxPaintDC dc( this );
-        //TRUE for masked images
-        dc.DrawBitmap( m_bitmap, 0, 0, TRUE );
+        dc.DrawBitmap( m_bitmap, 0, 0, TRUE /* use mask */ );
     }
 
     void OnSave(wxMouseEvent& WXUNUSED(event))
@@ -237,8 +241,9 @@ IMPLEMENT_APP(MyApp)
 IMPLEMENT_DYNAMIC_CLASS(MyCanvas, wxScrolledWindow)
 
 BEGIN_EVENT_TABLE(MyImageFrame, wxFrame)
-  EVT_PAINT(MyImageFrame::OnPaint)
-  EVT_LEFT_DCLICK(MyImageFrame::OnSave)
+    EVT_ERASE_BACKGROUND(MyImageFrame::OnEraseBackground)
+    EVT_PAINT(MyImageFrame::OnPaint)
+    EVT_LEFT_DCLICK(MyImageFrame::OnSave)
 END_EVENT_TABLE()
 
 BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)