hi i am trying to draw a polygon , in the code below wich is adapted from the Draw.pl demo in the win32-Gui package, the program run successfully if we uncomment the line : $DC->Rectangle(100, 100, 300, 200); and comment the line: $DC->Polygon(10, 10, 10, 200, 200, 200, 10, 10); but if we uncomment the $DC->Polygon(10, 10, 10, 200, 200, 200, 10, 10); and comment the $DC->Rectangle(100, 100, 300, 200); the program will crash. can someone tell me how to draw the polygon
# perl -w use strict; use warnings; use Win32::GUI(); my $left; my $top; my $right; my $bottom; my $P; my $oldP; my $B; my $oldB; my $Win = new Win32::GUI::Window( -left => 0, -top => 0, -width => 500, -height => 400, -name => "Window", -text => "Win32::GUI drawing demo", ); $Win->AddButton( -name => "Button1", -text => "RUN ", -pos => [ 0, 0 ], ); srand(); $Win->Show(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; } sub Button1_Click { my $DC = $Win->GetDC; my $x = 0; my $y = 0; $P = new Win32::GUI::Pen( -color => [ rand()*255, rand()*255, rand()*255 ], -width => rand()*5, ); $B = new Win32::GUI::Brush( [ rand()*255, rand()*255, rand()*255 ] ); $oldP = $DC->SelectObject($P); $oldB = $DC->SelectObject($B); # $DC->Rectangle(100, 100, 300, 200); $DC->Polygon(10, 10, 10, 200, 200, 200, 10, 10); $DC->SelectObject($oldP) if defined $oldP; $DC->SelectObject($oldB) if defined $oldB; } Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.http://us.rd.yahoo.com/evt=48518/*http://autos.yahoo.com/carfinder/;_ylc=X3oDMTE3NWsyMDd2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDY2FyLWZpbmRlcg-- hot CTA = Yahoo! Autos new Car Finder tool