Hi,

Seems the mailing list is messing up again - I didn't receive the original email in my main account (the original is repeated below).

Ok - when a window is moved over another window, windows sends a message to tell the window that it needs repainting. In most cases you don't need to do manual repainting as windows can do it for you - the big exception is owner drawn windows/controls. All you need to do is capture the paint event (via -onPaint) and redraw the window.

If you are drawing lots of lines and you want a flicker free approach (or just for performance reasons) you should consider drawing to an off-screen DC and using BitBlt to actually paint the image. See Region.pl in the examples for off-screen DC and BitBlt painting.

Cheers,

Jeremy.

---------------
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



Reply via email to