Hi
here is a plot to draw a time consuming drawing, i have used as a template the article in this forum "Drawing (Part 2) [Was: Refreshing the Window] , 04 Jun 2007 :
http://www.mail-archive.com/perl-win32-gui-users@lists.sourceforge.net/msg05195.html
it display a fractal plot like this:
http://postimage.org/image/8qo2j9s4/
the display begins when you clock RUN button. and it is displayed after 25 seconds on my computer. after that the plot will not be erased if covered by other windows.
in visual basic v6.0 there is a form property called AutoRedraw , if set to false the plot will be erased easily and if set to true the plot will persist. if possible i suggest a new feature for a future win32gui ; a new keyword AutoRedraw so if set to true the form will be refreshed  without the user to write all that very complex API code as in the example. ie that complex code will be hidden from the user.
regards
eros
if the listing of the code are not correct then download the file draw.pl from here:
http://www.mediafire.com/?eq62cwd8wq460rc
 
use Win32::GUI;
use warnings;
use strict;
use Win32::GUI qw( CW_USEDEFAULT RDW_VALIDATE RDW_NOCHILDREN COLOR_3DFACE );
# The size of the memory DC we will create to draw into
my ($WIDTH, $HEIGHT) = (640, 480);
my $mw = Win32::GUI::Window->new(
        -title => 'Draw ',
        -left => CW_USEDEFAULT,
        -size  => [ 640, 480 ],
        -onPaint => \&paint,
);

$mw->AddButton(
                -name => "Button1",
                -text => "RUN ",
                -pos  => [ 0, 0 ],
  -onClick => \&click,
    );
$mw->AddButton(
                -name => "Button2",
                -text => "CLS ",
                -pos  => [ 0, 30 ],
    );
# Create a memory DC to act as a buffer into which we'll
# do our drawing;  then in the paint handler we'll just bitblt()
# from the memory DC to the screen.
my $memDC;
my $mem_bitmap;
{
   my $dc = $mw->GetDC();
   $memDC = $dc->CreateCompatibleDC();
   $mem_bitmap = $dc->CreateCompatibleBitmap($WIDTH, $HEIGHT);
}
my $memDC_orig_state = $memDC->Save();
$memDC->SelectObject($mem_bitmap);
# Draw into the memory DC
FormLoadColor($memDC); # to paint the windows with green color
$mw->Show();
Win32::GUI::Dialog();
# Tidy up
$memDC->Restore($memDC_orig_state);
Win32::GUI::DC::DeleteObject($mem_bitmap);
Win32::GUI::DC::DeleteDC($memDC);
exit(0);
sub paint {
        my ($self, $dc) = @_;
 my $saved = $dc->Save();
  {
    my($l, $t, $r, $b) = $dc->GetUpdateRect(1);
    if(defined $l) {
           my $clip_rgn = Win32::GUI::Region->CreateRectRgn($l, $t, $r, $b);
           $dc->SelectClipRgn($clip_rgn);
       }
       # Validate the whole window
       $self->Redraw(RDW_VALIDATE | RDW_NOCHILDREN);
   }
$dc->BitBlt(0,0,$WIDTH,$HEIGHT, $memDC, 0,0);
$dc->Restore();
        return 1;
}
sub click {
    my ($self) = @_;
   MyDraw($memDC);
   $self->GetParent->InvalidateRect(1);
   return 1;
}
sub MyDraw {
   my ($dc) = @_;
   my $x=0; my $y=0; my $r=0;
  
   # background color
  
   $dc->FillRect( 0,0,$WIDTH,$HEIGHT, Win32::GUI::Brush->new( [(210,251,125)]) ); #color of background
      
   # Do our drawing
    my $pointsize = "1"; #size of the plot point
    my $pi = 3.1415926;
    my $axrng = 10.0;
    for($x=-$axrng; $x <= $axrng; $x += 0.03) {
     for($y=-$axrng; $y <= $axrng; $y += 0.03) {
           
      $r = cos($x) + sin($y);
      my $P = new Win32::GUI::Pen(
              -color => [ (cos($y*$r)*255, cos($x*$y*$r)*255, sin($r*$x)*255)], #color of the Plot
              -width => 1,
                                    );
       
          my $oldP = $dc->SelectObject($P);
       my $x1 = $x*20 + 250;
          my $y1 = $y*30 + 250;
          $dc->Circle($x1, $y1,$pointsize);
   }
#Win32::GUI::DoEvents();
   }
   return;
}
sub FormLoadColor {
   my ($dc) = @_;
   # Erase the background - COLOR_3DFACE is the window
   # background color
  
   $dc->FillRect( 0,0,$WIDTH,$HEIGHT,
        Win32::GUI::Brush->new( [(210,251,125)]) );
}
sub Button2_Click { 
   my $dc = $mw->GetDC;
   # Erase the background - COLOR_3DFACE is the window
   # background color
   $dc->FillRect( 0,50,$WIDTH,$HEIGHT,
       Win32::GUI::Brush->new( -system => COLOR_3DFACE ) );
  
 }
__END__