Hi, 
the following code will draw a line advancing slowly from top left to bottom
right, the condition is that i must draw it once only. so how i keep the
plot from been erased when covered by other windows !!.
i have tried many plans but failed. there is Update, and restore functions
but it seems it is not working. after the wingui code i present a TK code to
the same problem and it is working well.
i wish you all a happy new year 2010


use strict;
use warnings;

use Win32::GUI();
our $NumberOfLinesDrawn = 0;
my $Win = new Win32::GUI::Window(
    -left   => 0,
    -top    => 0,
    -width  => 500,
    -height => 400,
    -name   => "Window",
    -text   => "drawing line with animation",
    #-onPaint => \&Draw,
    
);

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

sub Window_Terminate {
    return -1;
}


sub Draw {
        my $DC = $Win->GetDC;
        my $x  = 0;
    my $y  = 0;
        for(1..300) {$y +=1; $x +=1;
            $DC->SetPixel($x,$y);
            #slowing the plot process:
            my $counter = 0;
            while($counter<100000){$counter+=1;}
           Win32::GUI::DoEvents;
    }
    #$DC->Validate();
    $NumberOfLinesDrawn +=1;
    print "$NumberOfLinesDrawn\n";
    }

the TK code:


use warnings;
use strict;        
use Tk;
my $mw = MainWindow->new;  
my $x = 0; my $y = 0;
my $counter=0; 
our $NumberOfLinesDrawn = 0;

my $c = $mw->Canvas(-width => 500, -height => 500); 
$c ->pack;

for(1..300) {$y +=1; $x +=1;
 
  $c -> createText( $x, $y, -fill => 'red', -text => '.');
    $counter=0;
    # delay loop
     while ($counter <= 100000) {
            $counter++;
                }
        $mw->update;
        }
        $NumberOfLinesDrawn +=1;
    print "$NumberOfLinesDrawn\n";
        MainLoop; 
        

-- 
View this message in context: 
http://old.nabble.com/updating-the-window-screen-tp27056406p27056406.html
Sent from the perl-win32-gui-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to