delphi修改点程序 运行不了
uses math;
procedure TForm1.DrawClockLine(Sender: TObject);
var
p:Tpoint;
begin
if FNeedErase then
begin
Image1.Canvas.MoveTo(FClockCenter.x,FClockCenter.y);
Image1.Canvas.LineTo(FLastPosition.x,FLastPosition.y);
end;
p:=GetNextPosition;
Image1.Canvas.MoveTo(FClockCenter.x,FClockCenter.y);
Image1.Canvas.LineTo(p.x,p.y);
FlastPosition:=p;
FNeedErase:=True;
end;
function Tform1.GetNextPosition:Tpoint;
var
d:double;
p:Tpoint;
begin
d:=(FLastposition.Y-fclockcenter.y)/Fradius;
if flastposition.x>=fclockcenter.x then
d:=Arcsin(d)+pi/30
else
d:=pi-Arcsin(d)+pi/30;
p.x:=round(fradius*cos(d)+fclockcenter.x);
p.Y:=round(fclockcenter.y+fradius*sin(d));
result:=p;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Fneederase:=false;
fradius:=100;
fclockcenter:=point(100,100);
flastposition:=point(100,0);
image1.canvas.Pen.color:=color;
image1.canvas.Pen.width:=2;
image1.canvas.Pen.mode:=pmnotxor;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
drawclockline;
end;
提示错误:not enough actual paraneters
答案:procedure TForm1.Timer1Timer(Sender: TObject);
begin
drawclockline(Sender);
//或者 drawclockline(self);
//或者drawclockline(nil);
end;
其他:procedure TForm1.Timer1Timer(Sender: TObject);
begin
drawclockline;
end;
缺少参数 提示错误为缺少参数,改为下面就可以了
procedure TForm1.Timer1Timer(Sender: TObject);
begin
drawclockline(nil);
end;
drawclockline(Sender: TObject)函数需要一个TObject类型的参数
上一个:小弟初学Delphi 学习过程中遇到一些程序错误不会改
下一个:DELPHI怎么把窗体写成DLL给其他程序调用