unit Unit1; interface usesSysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,Forms, Dialogs, StdCtrls, Grids, DBGrids, ExtCtrls, DBCtrls, DB, DBTables; typeTForm1 = class(TForm)Button1: TButton;Edit1: TEdit;procedure Button1Click(Sender: TObject);publicNextTop : integer;end; varForm1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject);varNewObj : TControl;NewClass: TPersistentClass;beginNewClass := FindClass(Edit1.Text);NewObj :=TControl(TComponentClass(NewClass).Create(Self));NewObj.Parent := Self;NewObj.Name := NewObj.ClassName+IntToStr(NextTop);NewObj.Top := NextTop;NextTop := NextTop+20;end; initializationRegisterClasses([TButton,TEdit,TLabel]);end. |
[000483]