Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Button2: TButton;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- const n = 20;
- p: array of point;
- public
- end;
- var Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.FormCreate(Sender: TObject);
- var
- cx, cy, i: integer;
- a: real;
- begin
- setlength(p, n);
- a := 0;
- cx := Form1.GetWidth div 2;
- cy := Form1.GetHeight div 2;
- for i := 0 to n - 1 do
- begin
- p[i].x := cx + round(240 * cos(a));
- p[i].y := cy + round(240 * sin(a));
- a := a + 2 * Pi / n;
- end;
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- var
- i, j: integer;
- begin
- With Form1.Canvas do
- begin
- Poligon(p);
- for i := 0 to n - 1 do
- for j := 0 to n - 1 do
- if i <> j then
- begin
- MoveTo(p[i].x, p[i].y);
- LineTo(p[j].x, p[j].y);
- end;
- end;
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- Form1.Close;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement