给你一个简单的程序吧,看看你指的“很长的周期”可不可以满足。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Button1: TButton;
procedure FormPaint(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure DrawCoor;
procedure DrawCos;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.DrawCoor;
begin
With Canvas do begin
MoveTo(0,Trunc(Height/2));
LIneTo(Width,Trunc(Height/2));
MoveTo(Trunc(Width/2),0);
LIneTo(Trunc(Width/2),Height);
end;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
DrawCoor;
DrawCos;
end;
procedure TForm1.DrawCos;
var
I : integer;
Y : integer;
begin
for I := -Trunc(Width) to Width do begin
Y := Trunc(StrToFloat(Edit1.Text) * Cos(StrToFloat(Edit2.Text)*I));
if I = 1 then Canvas.MoveTo(I + Trunc(Width/2),Y + Trunc(Height/2)) else Canvas.LineTo(I + Trunc(Width/2),Y+ Trunc(Height/2));
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Refresh;
end;
end.