Информатика. Программирование в Delphi
242
a:integer;
i:integer;
begin
a:=18;
for i:=1 to 10 do
begin
if i mod 2 =0 then
begin
p[i].X:=x0+round(r/3*cos(a*2*pi/360));
p[i].Y:=y0-round(r/3*sin(a*2*pi/360));
end
else
begin
p[i].X:=x0+round(r*cos(a*2*pi/360));
p[i].Y:=y0-round(r*sin(a*2*pi/360));
end;
a:=a+36;
end;
p[11].X:=p[1].X;
p[11].Y:=p[1].Y;
Form1.Canvas.Polyline(p);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
Form1.Caption:='Звезда';
Form1.BorderStyle:=bsDialog;
Form1.PopupMenu:=PopupMenu1;
Form1.Canvas.Pen.Color:=random(65536);
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button:
TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
r:integer;
begin
r:=random(100);
starline(x,y,r);
end;