I have a window that contains a Win32::GUI::Graphic.  I get the DC of the Grpahic and then draw lines in it every second like a real time graph.  The problem is that whenever the window is minimized or another window moves over it, the lines are lost.  What am I missing here?  Here is a simple example:
 

#!c:\perl58\bin\perl -w

use Win32::GUI;

$Win = new Win32::GUI::Window(-name=>"TestWindow",-text=>"Test",-left=>100,-top=>100,-width=>800,-height=>300,);
$Win->AddLabel(-name=>"backlabel1",-left=>18,-top=>18,-width=>764,-height=>104,-sunken=>1);
$Win->AddGraphic(-name=>"graphic1",-left=>20,-top=>20,-width=>760,-height=>100);
$Win->AddButton(-name=>"button1",-text=>"Test",-left=>20,-top=>130);

my $dc1 = $Win->{graphic1}->GetDC();
my $curx = 0;
my @points = split(/,/,<DATA>);

$Win->Show();
Win32::GUI::Dialog();

sub Window_Terminate {
    return -1;
}

sub button1_Click
{
    for my $point(@points)
    {
        $dc1->LineTo($curx,$point);
        $curx += 4;
    }
    $dc1->MoveTo(0,0);
    $curx = 0;
    return;
}


__DATA__
10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50,10,50,20,30,60,80,5,90,35,55,20,50,30,70,2,65,34,73,50

 

 Any help would be greatly appreciated. 

Thanks,

--
Chris Rogers
www.pcewebs.com