一个动态建立组件的程序
procedure TForm1.FormMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;x,y:integer);
var
Btn:TButton;
begin
Btn:=TButton.Create(Self);
Btn.Parent:=Self;
Btn.Left:=x;
Btn.Top:=y;
Btn.Caption:=('Button at %d %d',[x,y]);
end;
为什么我运行的时候老是说Undeclared identifier:'TButton'
procedure TForm1.FormMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;x,y:integer);
var
Btn:TButton;
begin
Btn:=TButton.Create(Self);
Btn.Parent:=Self;
Btn.Left:=x;
Btn.Top:=y;
Btn.Caption:=('Button at %d %d',[x,y]);
end;
为什么我运行的时候老是说Undeclared identifier:'TButton'
Btn.Parent:=Self;
Btn.Left:=x;
Btn.Top:=y;
Btn.Caption:=Format('Button at %d %d',[x,y]);
没Format
为什么我运行的时候老是说Undeclared identifier:'TButton'
应该是你编译的时候,弄清楚什么是运行时
but not runtime
刚才把Format写掉了,我的意思就是在编译的时候,下次一定写得清楚明白。