thanks Rob very much for the polygon function.
i have noticed that the calls to the functions are within the paint sub. but what if i want to display the graphics uppon a click on a button. indeed i have tried using onPaint with no success. here is an example with my failed lines tries are commented
#!perl -w
use strict;
use warnings;
use Win32::GUI qw();
my $mw = Win32::GUI::Window->new(
-title => 'Graphic',
-size => [ 400, 300 ],
#-onPaint => \&paint,
);
$mw->AddButton(-name=>"button1",-text=>"RUN  ",-left=>0,-top=>0);
$mw->Show();
Win32::GUI::Dialog();
$mw->Hide();
exit(0);
sub button1_Click {
my $dc = $mw->GetDC;
#my ($self, $dc) = @_;
$dc->Validate();
# Draw a rectangle
$dc->Rectangle(100,100,200,200);
return 0;
}

 


Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV.