那你可以自己做一个:
给你一些关键性的步骤。
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
StdCtrls, ExtCtrls, Buttons, Clipbrd, Comctrls, Db, Dbcgrids,
Dbctrls, Dbgrids, Dblookup, Dbtables, Ddeman, Dialogs,
Filectrl, Grids, Mask, Menus, Mplayer, Oleconst, Olectnrs,
Olectrls, Outline, Tabnotbk, Tabs;
type
TClassArray = array [1..107] of TPersistentClass;
// definition temporary used to check the data types
// TClassArray = array [1..107] of TComponentClass;
const
ClassArray: TClassArray = (
TApplication, TDDEServerItem, TPanel, TAutoIncField,
TDirectoryListBox, TPopupMenu, TBatchMove, TDrawGrid,
TPrintDialog, TBCDField, TDriveComboBox, TPrinterSetupDialog,
TBevel, TEdit, TProgressBar, TBitBtn,
TField, TQuery, TBlobField, TFileListBox,
TRadioButton, TBooleanField, TFilterComboBox, TRadioGroup,
TButton, TFindDialog, TReplaceDialog, TBytesField,
TFloatField, TCheckBox, TFontDialog,
TRichEdit, TColorDialog, TForm, TSaveDialog,
TComboBox, TGraphicField, TScreen, TCurrencyField,
TGroupBox, TScrollBar, TDatabase, THeader,
TScrollBox, TDataSource, THeaderControl, TSession,
TDateField, THotKey, TShape, TDateTimeField,
TImage, TSmallIntField, TDBCheckBox, TImageList,
TSpeedButton, TDBComboBox, TIntegerField, TStatusBar,
TDBCtrlGrid, TLabel, TStoredProc, TDBEdit,
TListBox, TStringField, TDBGrid, TListView,
TStringGrid, TDBImage, TMainMenu, TTabbedNotebook,
TDBListBox, TMaskEdit, TTabControl, TDBLookupCombo,
TMediaPlayer, TTable, TMemoField, TDBLookupComboBox,
TMemo, TTabSet, TDBLookupList, TTabSheet,
TDBLookupListBox, TMenuItem, TTimeField, TDBMemo,
TNotebook, TDBNavigator, TOleContainer, TTimer,
TDBRadioGroup, TOpenDialog, TTrackBar, TDBText,
TOutline, TTreeView, TDDEClientConv, TOutline,
TUpdateSQL, TDDEClientItem, TPageControl, TUpDown,
TDDEServerConv, TPaintBox, TVarBytesField, TWordField);
procedure GenerateComponent(AParent:TComponent;AClass:String;X,y:Integer);
var //AClass来自ComboBox1或你自己定义的东西
MyClass:TComponentClass;
MyObj:TComponent;
begin
MyClass:=TComponentClass(GetClass(AClass));
if MyClass=nil then beep;
else
begin
MyObj:=MyClass.Create(AParent);
if MyObj.InheritsFrom(TControl) then
begin
TControl(MyObj).Left:=X;
TControl(MyObj).top:=Y;
TControl(MyObj).Parent:=AParent;
end;
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
var
I: Integer;
begin
//注册类
RegisterClasses (Slice (ClassArray, High (ClassArray)));
for I := Low (ClassArray) to High (ClassArray) do
ComboBox1.Items.Add (ClassArray .ClassName); //在主Form上放个ComboBox1,然后根据在ComboBox1中的选择
//调用上面的过程生成组件。
end;