+#if wxUSE_UNICODE
+ if (event.m_uniChar)
+ {
+ m_text += event.m_uniChar;
+ Refresh();
+ return;
+ }
+#endif
+
+ // some test cases
+ switch (event.m_keyCode)
+ {
+ case WXK_UP: m_text += wxT( "<UP>" ); break;
+ case WXK_LEFT: m_text += wxT( "<LEFT>" ); break;
+ case WXK_RIGHT: m_text += wxT( "<RIGHT>" ); break;
+ case WXK_DOWN: m_text += wxT( "<DOWN>" ); break;
+ case WXK_RETURN: m_text += wxT( "<ENTER>" ); break;
+ default: m_text += (wxChar)event.m_keyCode; break;
+ }
+}
+
+void MyCanvas::DoPaint(wxDC& dc)
+{
+ dc.SetBrush( *wxBLACK_BRUSH );
+ dc.DrawRectangle( 10,10,200,50 );
+
+ dc.DrawBitmap( m_bitmap, 10, 20, true );
+
+ dc.SetTextForeground(*wxBLUE);
+ dc.DrawText(_T("This text is drawn from OnPaint"), 65, 65);
+
+ wxString tmp;
+ tmp.Printf( _T("Hit any key to display more text: %s"), m_text.c_str() );
+ int w,h;
+ dc.GetTextExtent( tmp, &w, &h );
+ dc.SetBrush( *wxWHITE_BRUSH );
+ dc.DrawRectangle( 65, 85, w, h );
+ dc.DrawText( tmp, 65, 85 );
+
+#if 0
+ wxRegionIterator upd( GetUpdateRegion() );
+ while (upd)
+ {
+ wxLogDebug( _T("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( _T("size %d %d client_size %d %d"), size.x, size.y, client_size.x, client_size.y );
+#endif
+
+#if 0
+ 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 );
+