Hi,
Within an EVT_PAINT handler you should always use Wx::PaintDC.
Wx::ClientDC is only for drawing outside the PAINT event handler.
It also probably makes sense to only call the drawing code within the
EVT_PAINT handler. You should find that a resize causes repainting anyhow.
If you want to cause a repaint from your own code, better to call
$window->Refresh(); which will cause a paint event when the system is
ready to paint. Revisit the $window->Refresh() docs to remind yourself
of the params that takes and experiment with what you might need.
Hope it helps.
Mark
On 18/08/2012 14:55, Johan Vromans wrote:
Hi,
Usually I use Wx::StaticBitmap to display images, but now I decided to
give the 'official' way a try.
So I have something similar to:
sub draw {
...
my $img = Wx::Image->new( ... );
... some image manipulations ...
my $bm = Wx::Bitmap->new( $img );
my $dc = Wx::ClientDC->new( $panel );
$dc->Clear;
$dc->DrawBitmap( $bm, 0, 0, 0 );
}
I call this subroutine from the PAINT and SIZE events.
It works fine, except for flicker. Every time a new image is drawn,
there's flicker. I've verified that the draw routine is called only once
so that cannot be the problem. Apparently I'm overlooking something.
Any hints?
Thanks,
Johan