Hi George, As a quick reply (I don't have perl on this machine) just invalidate the area that needs to be redrawn and windows will then fire the paint event. You always have your drawing in the paint event.
Cheers, jez -----Original Message----- From: "George" <[EMAIL PROTECTED]> To: "perl-win32-gui-users@lists.sourceforge.net" <perl-win32-gui-users@lists.sourceforge.net> Sent: 26/05/07 08:08 Subject: [perl-win32-gui-users] Refreshing the Window 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.