嗯,luoyanqing119 说得很清楚;
如
type
TCtrlClass = class of TControl;
procedure TForm1.btn1Click(Sender: TObject);
procedure CreateAControl(ACtrlClass: TCtrlClass;
const LeftPos: Integer);
begin
with ACtrlClass.Create(self)do
begin
Left := LeftPos;
top := 10;
width := 50;
Parent := Self;
end;
end;
begin
CreateAControl(TButton, 10);
CreateAControl(TEdit, 60);
end;