|
From: Mark D. <mar...@zn...> - 2007-03-29 05:11:04
|
Hi,
The attached diff solves the problem and the code below now works as expected. Note, you have to call DoPrepareDC to get the overridden method - just like it says in the docs :-)
Having a method loaded via Wx.pm looks a bit crufty - but it was the best I could manage and does the 'right' thing vs inheritance etc. (I think).
Anyone for further testing ?
Mark
sub new {
.......
.......
$self->set_user_scale(0.5,0.5);
.......
.......
}
sub OnDraw {
my($self, $dc) = @_;
...........
...........
}
sub DoPrepareDC {
my ($self, $dc) = @_;
$self->SUPER::DoPrepareDC( $dc );
$dc->SetUserScale( $self->get_user_scale() );
}
sub get_user_scale {
my ($self) = @_;
return @{ $self->{_user_scale} };
}
sub set_user_scale {
my ($self, $scalex, $scaley) = @_;
$self->{_user_scale} = [ $scalex, $scaley ];
}
|