thanks for the response, but where should we insert the invalidate function, i am lost completely. and many discussions in the forum are complicated and for experts only, i have tried many variations with no success. the available examples in the forum are calling a sub paint which includes the drawing functions inside it ,and it happend the drawing functions are speedy, but suppose a function are drawing a fractal and this is a time consuming, then we will see that this approach is unpractical, we just want to refresh the points of color ,and not to recalculate the code everytime we move or hide the window. i wish that a future version of win32-gui may have something like AutoRedraw property in visual basic 6 which are refreshing the Form . i repost the example who need a cure, the problem is that i want the rectangle to be drawn uppon a click from a button and not within a paint procedure or a Timer. #!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; } regards
--------------------------------- Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.