📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
PolyArray:array of TPoint;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:Integer;
Count:Integer;
begin
Count:=StrToInt(self.Edit1.Text);
SetLength(PolyArray,Count+1);
for i:=0 to Count-1 do
begin
PolyArray[i]:=Point(Trunc(Sin((2*PI)*i/Count)*100)+(self.Width div 2),
Trunc(Cos((2*PI)*i/Count)*100)+(self.Height div 3));
end;
PolyArray[Count]:=PolyArray[0];
self.Refresh;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
self.Canvas.Polyline(PolyArray);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -