+ wxBitmap mono( 60,50,1 );
+ wxMemoryDC memdc;
+ memdc.SelectObject( mono );
+ memdc.SetPen( *wxBLACK_PEN );
+ memdc.SetBrush( *wxWHITE_BRUSH );
+ memdc.DrawRectangle( 0,0,60,50 );
+ memdc.SetTextForeground( *wxBLACK );
+ memdc.DrawText( "Hi!", 5, 5 );
+ memdc.SetBrush( *wxBLACK_BRUSH );
+ memdc.DrawRectangle( 33,5,20,20 );
+ memdc.SetPen( *wxRED_PEN );
+ memdc.DrawLine( 5, 42, 50, 42 );
+ memdc.SelectObject( wxNullBitmap );
+
+ if (mono.Ok())
+ {
+ dc.DrawText( "Mono bitmap", 30, 1865 );
+ dc.DrawText( "(red on green)", 30, 1880 );
+ dc.SetTextForeground( "RED" );
+ dc.SetTextBackground( "GREEN" );
+ dc.DrawBitmap( mono, 30, 1900 );
+
+ dc.SetTextForeground( "BLACK" );
+ dc.DrawText( "After wxImage conversion", 150, 1865 );
+ dc.DrawText( "(red on white)", 150, 1880 );
+ dc.SetTextForeground( "RED" );
+ wxImage i( mono );
+ i.SetMaskColour( 255,255,255 );
+ i.Replace( 0,0,0,
+ wxRED_PEN->GetColour().Red(),
+ wxRED_PEN->GetColour().Green(),
+ wxRED_PEN->GetColour().Blue() );
+ dc.DrawBitmap( i.ConvertToBitmap(), 150, 1900, TRUE );
+ dc.SetTextForeground( "BLACK" );
+ }