Ñîçäàíèå PolyPolygon èñïîëüçóÿ ìàññèâ òî÷åê?
Ñîçäàíèå PolyPolygon èñïîëüçóÿ ìàññèâ òî÷åê?
Polygon - ìåòîä êîìïîíåíòà TCanvas ïîëó÷àåò â êà÷åñòâå ïàðàìåòðà äèíàìè÷åñêèé ìàññèâ òî÷åê. Ôóíêöèÿ PolyPolygon() èç Windows GDI ïîëó÷àåò óêàçàòåëü íà ìàññèâ òî÷åê.
procedure TForm1.Button1Click(Sender: TObject);
var
ptArray: array[0..9] of TPOINT;
PtCounts: array[0..1] of integer;
begin
PtArray[0] := Point(0, 0);
PtArray[1] := Point(0, 100);
PtArray[2] := Point(100, 100);
PtArray[3] := Point(100, 0);
PtArray[4] := Point(0, 0);
PtCounts[0] := 5;
PtArray[5] := Point(25, 25);
PtArray[6] := Point(25, 75);
PtArray[7] := Point(75, 75);
PtArray[8] := Point(75, 25);
PtArray[9] := Point(25, 25);
PtCounts[1] := 5;
PolyPolygon(Form1.Canvas.Handle,PtArray, PtCounts, 2);
end;