我在 stackoverflow 上阅读了许多关于扩展 TFrame 以拥有自己的已发布属性的文章。
我基本上遵循了约翰·托马斯的方法
在这里重复代码:
unit myUnit;
uses
...
type
TmyComp = class(TFrame) //set your frame name to be the name your component
ToolBar1: TToolBar; //different components added in the form designer
aliMain: TActionList;
...
published //this section is added by hand
property DataSource: TDataSource read FDataSource write SetDataSource; //some published properties added just for exemplification
property DefFields: string read FDefFields write SetDefFields;
...
end;
procedure Register; //added by hand
implementation
{$R *.DFM}
procedure Register;
begin
RegisterComponents('MyFrames', [TmyComp]); //register the frame in the desired component category
end;
新的框架组件很好地显示在组件托盘上。我可以将新框架添加到表单并工作。
但是我需要将我的新框架作为一个独立单元使用,例如由 file->new->other->vcl 框架创建
我将所有框架都创建为单独的单元,然后在需要时插入表格。
我的新 MyFrame 应该怎么做?