Stephen: I'm using Delphi-3. It won't accept an open array of TPoint. Open arrays only work with a few simple types in D3. Anyway I got it working with the Slice function as suggested.
----- Original Message ----- From: "Stephen Posey" <[EMAIL PROTECTED]> To: "Borland's Delphi Discussion List" <[email protected]> Sent: Thursday, July 27, 2006 9:42 AM Subject: Re: Polygon with variable array > Whitehat wrote: > > Yes I'm using Canvas.Polygon(Points). > > I set > > var > > Points:array[0..99] of TPoint; > > Now if my procedure call is to use say only the first 20 points it goes > > ahead and uses the rest of the points as well. If there was data there > > from a previous call, what a mess. So, as I said, to get around it, I > > just filled in the remainder of the points with the values for the last > > point. > > It works. > > I tried using an open array but it would not compile. > > Something like the following works fine for me, what are you doing > differently? > > procedure TForm1.Button1Click(Sender: TObject); > var > A: array of TPoint; > begin > SetLength(A, 6); > > // draw a pentagon > A[0].X := ClientWidth div 2; A[0].Y := 10; > A[1].X := ClientWidth div 2; A[1].Y := 10; > A[2].X := ClientWidth div 2 + 50 ; A[2].Y := 50; > A[3].X := ClientWidth div 2 + 30; A[3].Y := 100; > A[4].X := ClientWidth div 2 - 30; A[4].Y := 100; > A[5].X := ClientWidth div 2 - 50; A[5].Y := 50; > > Canvas.Pen.Color := clRed; > Canvas.Pen.Width := 3; > Canvas.Polygon(A); > end; > > > Stephen Posey > [EMAIL PROTECTED] > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi > > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.1.371 / Virus Database: 268.10.3/395 - Release Date: 7/21/2006 > > _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

